I think I understand what you’re saying, tell me if I’m wrong.
To you “top-level pages” are the zola concept of “sections”. For example, content/index.md
would be a section, which would compile to just /
as a URL path. A section is any markdown file, inside the content directory, named index.md
.
So if you had writings/index.md
then that would also be a section and the URL path when compiled would be /writings/
.
All other markdown files are “pages” in zola lingo. So that would be projects.md
, ....md
, and whatever else is inside writings
.
You can certainly have all the pages share the same template and it looks from your directory structure that you understand how to do that. You would just need to put in the front matter of each of your pages the template that you want them to use. If not template is specified then Zola will automatically use page.html
for pages.
Is it possible to keep the top-level pages in markdown?
I think you’re asking if it’s possible to have the sections have their markdown content shown literally, instead of being rendered as html? Tell me if I have that wrong.
Anyways, yes you can certainly do that.
The variable that stores the contents of the markdown, section.content
, keeps everything in escaped html, so that won’t work in this case. Instead you would need to load the content more like this:
{% set content = load_data(path=section.path) %}
And then you can use it literally.
One other thing is that you will probably want to use that literal content within <pre>
tags, if you don’t already know, because in html all the whitespace will be stripped out otherwise.
Last piece of advice, you’ll probably want to have your structure like this
- a
base.html
template with all of your <head>
information
- a
section.html
template that extends base.html
and inserts the content how I showed just above
- a
page.html
template that extends base.html
- a
404.html
template that extends base.html
You probably don’t want the 404.html to be the same as the page templates because there is no page
variable, but you can certainly have it extend base.html
and then do any further customization needed from there.
Hopefully that answer helps? Good luck with Zola!