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

A separated folder for content only like _inc folder #494

Closed
ngdangtu-vn opened this issue Oct 1, 2023 · 4 comments
Closed

A separated folder for content only like _inc folder #494

ngdangtu-vn opened this issue Oct 1, 2023 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@ngdangtu-vn
Copy link
Contributor

Enter your suggestions in details:

Right now, content has been mixed up with logic & templates. While it has some advantage to make the content even more flexible. I still need content (and data) in a separated folder. With this feature being implemented, we can gain benefits:

  1. Ability to use repo module thanks to content can be keep in a separated folder
  2. From point 1, it make the content easily to be backup.
  3. Other Static CMSes, for instance decapcms.org, can easily support without breaking anything in the logic or template.

Is it possible to do it without mess up the core?

@ngdangtu-vn ngdangtu-vn added the enhancement New feature or request label Oct 1, 2023
@oscarotero
Copy link
Member

I think Lume does the opposite: all templates, layouts, etc are in one folder (_includes) and the site content is out of this folder.

I can think of different ways to do that:

  • Use themes. You can load any not-content file remotely, so you only have content files in the repo. The simple_blog theme does that: https://github.com/lumeland/theme-simple-blog/blob/main/mod.ts#L12-L48
  • Use symlinks. In Lume you can create symbolic links in the src folder to other files/folders outside this folder.
  • Save all your content in a folder (like /content/). All pages will have the url /content/.... Then you can create a function to remove this part ((page) => page.data.url === page.data.url.replace("/content/", "/"))

@ngdangtu-vn
Copy link
Contributor Author

About the theme, do you think it can work with Modules template engine? Because I use it a lot.

I think I will combine symlinks and rewrite urls options. It is possible for lume to read content from symlinks right? I plan to put content outside the _src and link it to _src/content.

@oscarotero
Copy link
Member

oscarotero commented Oct 6, 2023

About the theme, do you think it can work with Modules template engine? Because I use it a lot.

It works for layouts (layout: mytemplate.tmpl.js), but not for direct imports (for example, `import foo from "./foo.ts"). although you can use import maps for that.

It is possible for lume to read content from symlinks right?

Yes, it was added on version 1.18.0.

BTW, In Lume 2.0 it will be possible to omit a folder name. For example, if a file is in /content/articles/article-name.md, you can configure the folder content to omit its name when generating the final urls. So the url will be /articles/article-name/ (without the/content part).

@oscarotero oscarotero added this to the 2.0.0 milestone Nov 6, 2023
@oscarotero
Copy link
Member

Implemented in Lume 2 with the new basename variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants