Skip to content

Commit 26aae31

Browse files
committed
updated post
1 parent cc534cc commit 26aae31

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

posts/lume-3.md

+38
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,44 @@ This function generates a page per item. Instead of returning an object with the
529529
`url` property, it returns the `basename` so it's appended to the URL of the
530530
generator (`/items/computer/`, `/items/mug/`, `/items/spoon/`).
531531

532+
## Date detection from filepath is disabled by default
533+
534+
Lume 2 detects automatically the `date` value from the files and folders paths
535+
and remove it. For example, the file `/posts/2020-06-21_hello-world.md` outputs
536+
the page `/posts/hello-world/` (without the date).
537+
538+
Some people don't want this behavior and prefer to keep the date in the output
539+
URL. Following the Lume's philosophy of having a light core and provide extra
540+
features through plugins, this feature was removed from the core and the new
541+
`extract_date` plugin was created to enable it.
542+
543+
```js
544+
import lume from "lume/mod.ts";
545+
import extractDate from "lume/plugins/extract_date.ts";
546+
547+
const site = lume();
548+
549+
site.use(extractDate());
550+
551+
export default site;
552+
```
553+
554+
By default the plugin provides the same behavior of Lume 2, but it's possible to
555+
extract the date without removing it from the URL:
556+
557+
```js
558+
import lume from "lume/mod.ts";
559+
import extractDate from "lume/plugins/extract_date.ts";
560+
561+
const site = lume();
562+
563+
site.use(extractDate({
564+
remove: false, // Keep the date
565+
}));
566+
567+
export default site;
568+
```
569+
532570
## Removed plugins
533571

534572
In addition to `jsx_preact`, two more plugins were removed in Lume 3: `liquid`

0 commit comments

Comments
 (0)