Blog posts in folders (with assets)/nested shortcodes #197
-
Hi all! After playing with Lume I am blown away by its flexibility. Excellent work, guys! I would like to migrate a number of rather large scale Hugo and Eleventy projects to Lume and I have a few questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 28 replies
-
Hi, @Brixy
The url generation in Lume doesn't work exactly like Hugo: The date from the path is extracted only if it's in the filename but not in the folder name. In your example, Fortunately, you can use javascript functions to customize the final url of the pages See this. You can create a export function url(page) {
const path = page.src.path; // The path name without extension (ex: /blog/2022-05-01_first-post/index)
const url = generateMyOwnUrl(path); // This returns something like /blog/first-post/
return url;
} Another way is by creating a preprocessor, that can change the url before rendering the page: // Preprocess all html pages
site.preprocess([".html"], (page) => {
const path = page.src.path; // The path name without extension (ex: /blog/2022-05-01_first-post/index)
const url = generateMyOwnUrl(path); // This returns something like /blog/first-post/
page.url = url; // Assign the new url to the page
});
Yes. If you are going to use imagick plugin, just import it in your config file and that's all. By default the extensions import lume from "lume/mod.ts";
import imagick from "lume/plugins/imagick.ts";
export default lume()
.use(imagick({
extensions: [".jpg"], //If you only want to load jpg files
));
Yes, you have to define the helper as site.addHelper('blockquote', blockquote, { body: true, type: "tag" }); |
Beta Was this translation helpful? Give feedback.
-
I've created an issue to support dates in directories: #198 But I have some questions?:
This week I'd like to release a new Lume version and want to include this. |
Beta Was this translation helpful? Give feedback.
-
The combination of removing the So for reference, this is what I have come up with – in case anyone might need it. There are probably more elegant solutions; but this works ;-)
|
Beta Was this translation helpful? Give feedback.
Hi, @Brixy
The url generation in Lume doesn't work exactly like Hugo: The date from the path is extracted only if it's in the filename but not in the folder name. In your example,
/blog/2022-05-01_first-post/index.md
outputs to/blog/2022-05-01_first-post/index.html
, butblog/2022-05-02_second-post.md
outputs toblog/second-post/
(because the date is defined in the filename, not in the folder). I think this could be implemented easily but it's not available right now.Fortunately, you can use javascript functions to customize the final url of the pages See this. You can create a
blog/_data.js
file and export theurl
…