Comments (6)
Good point, I'll fix that
from zola.
That's actually quite tricky!
We need to render pages from the render_sections
so we can sort/populate prev/next correctly but we also want to render correctly prev/next for the index page if we don't have a section for content like my site.
So we would have 2 spots to render a page: render_section
and build_pages
. render_section
needs to be called first and build_pages
can check whether the file already exists and if not, populate with "global" previous/next and render the page.
The index page does seem a bit too magical looking at the above, I'll need to think a bit more on what would be the best behaviour for it. Maybe I was thinking too much about how Hugo does it while it could be done better.
from zola.
(writing down some thoughts)
So after some thoughts the problem boils down to the differences between a simple case (blog + about page) and more complex cases such as blog + landing page + knowledge base for example. Your blog is a bit towards the simple case where you have a few sections that you want to order separately but never together. It's more a documentation site in this regard.
I can't think of a single case where you would to mix sections automagically in the index page though.
A few solutions came to mind but after writing this only one didn't feel like a hack, let's take a simple case as example since this is where the confusion comes I think.
content/
- _index.md
- one-blog-post.md
- another-blog-post.md
- pages/
- about.md
- projects.md
Make index a (almost) pure section
Which means it won't automatically get variables like pages
at all. The index will still get variables like sections
but it will only get pages directly next to the content/_index.md
. In the example, section.pages
in the landing page will contain one-blog-post
and another-blog-post
and a user would iterate like so:
{% for page in section.pages %}...{% endfor %}
The index section
may or may not be contained in the sections
variable passed to the template, I'm not convinced about the necessity of doing that yet.
Pages will be sorted by the index section depending on the sort_by
parameter and prev/next will always only apply inside a section only.
I think this approach solves most of the issue and will do what people expect to most of the time. It's not as straightforward as Hugo might be but I believe it's not that far in practice and removes ambiguity for the index page.
from zola.
The last question to solve for it to make sense is what to do with pages with no sections (orphan pages). Those should still be rendered but won't be listed in any section.pages
.
The easiest way would be to find make the list of pages in sections and compare those missing from the full list of pages and render the orphan pages after rendering all sections.
from zola.
Implementation is in #60 which should also fix what this issue is about!
I'll need to test it a bit more myself though.
from zola.
@phil-opp it should be working in master
Edit: also in 0.0.5 that was just released
from zola.
Related Issues (20)
- Two shortcode problems HOT 3
- Broken shortcodes on 0.19 HOT 10
- Breaking changes documentation for v0.19 (generate_feeds, feed_filenames, path..) HOT 2
- How to iterate through the list of top-level sections HOT 4
- Guide to Deploy to Codeberg Pages HOT 1
- Feature request: load_data for TSV and other non-comma-separated CSV HOT 2
- How create a frontmatter extra object HOT 1
- `linenos` syntax highlighting is a semantic mess HOT 11
- Variable `config.feed_filename` not found in context while rendering 'section.html' HOT 4
- Feature Request: TLA+ Syntax Highlighting Support HOT 1
- Live reload not working on Windows HOT 3
- How to change html tags based on whether a variable exist in a page or not. HOT 5
- In Zola templates that extend another template, variables declared at top-level are silently ignored HOT 2
- Confusing error message when trying to import macros in any place other than the start of the template file
- Undocumented or Faulty: linking colocated assets on a slug page through template HOT 3
- Get unrendered page.content in templates HOT 1
- Zola panics if static directory does not exist (with compile_sass = false) HOT 1
- How do I include another markdown file in `docs` markdown file? HOT 2
- Footnotes are not permalinked HOT 4
- Regression introduced in v0.19.0 to config.toml HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zola.