Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support global templateEngine settings with images in content folders #203

Closed
Brixy opened this issue May 28, 2022 · 2 comments
Closed

Support global templateEngine settings with images in content folders #203

Brixy opened this issue May 28, 2022 · 2 comments
Milestone

Comments

@Brixy
Copy link

Brixy commented May 28, 2022

I am just porting another site to Lume from Eleventy. And it works just great!

The old sites uses Eleventy’s Nunjucks shortcodes within markdown files. Lume supports this with templateEngine: njk,md in front matter.

Yet, I noticed an issue: Apparently you cannot use this setting globally for all blog posts in combination with images in folders, probably because images are pages in Lume:

# posts/_data.js
export const templateEngine = 'njk,md';
posts/
└── 2022-05-28_a-post/
    ├── index.md
    ├── file.pdf
    └── image.jpg

As soon as you remove the image file from the folder everything works as expected.

(Honestly speaking I have not tried Lume’s modules plugin with this combination.)

Thank you.

@oscarotero
Copy link
Member

Mmm, I understand.

In Lume all files are "pages" but there are two types of pages: regular pages and assets pages (it's explained here). Assets pages don't apply the layout variable (to avoid an image/css/js be wrapped in a layout), but it do apply the render. Maybe assets pages shouldn't be rendered, and only apply (pre)processors.

As a workaround, you can use a preprocessor to apply the templateEngine variable only to md files:

site.preprocess([".md"], (page) => page.data.templateEngine = "njk,md");

@Brixy
Copy link
Author

Brixy commented May 28, 2022

This works perfectly! Thank you.

A global setting of templateEngine does not seem to have any disadvantages.

oscarotero added a commit that referenced this issue May 28, 2022
@oscarotero oscarotero added this to the 1.10.0 milestone Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants