zola
zola copied to clipboard
Section that is nested under a page takes file path instead of URL path
Bug Report
Note: more info from zola discourse page
Consider the following directory structure for the rest of the bug report.
EDIT: this is fixed in https://github.com/getzola/zola/pull/2369
# The following files
/content/posts/2013-06-02_my-vacation/index.md
/content/posts/2013-06-02_my-vacation/comments/_index.md
Environment
Zola version: 0.17.2
Expected Behavior
Tell us what should have happened.
The URL path for comments should be:
/posts/my-vacation/comments
Current Behavior
Tell us what happens instead of the expected behavior. If you are seeing an error, please include the full error message and stack trace. You can get the stacktrace of a panic by adding
RUST_BACKTRACE=1
when running azola
command.
It's currently this:
/posts/2013-06-02_my-vacation/comments
Step to reproduce
Please provide the steps to reproduce the issue. If the issue is hard to reproduce, please provide a sample repository or sample that triggers the bug.
- Create a page with a dated assets directory (i.e. /contents/posts/2013-06-02_my-vacation/index.md)
- Create a section as a subdirectory of the page from step 1
- Navigate to the "comments" section in the browser and you will observe the expected vs actual
I just realised:
# The following files
/content/posts/2013-06-02_my-vacation/index.md
/content/posts/2013-06-02_my-vacation/comments/_index.md
is not meant to work, you cannot nest sections under a page.
I see, I think that mostly makes sense, but consider the following edge case.
You have a post about your vacation, which has a commenting section. Let’s assume the comments are pages too.
Without allowing sections nested under pages there’s no good way to paginate the comment section.
Also, keep in mind that the above directory structure still works, as in it compiles, but it works in a way that defies how people expect it to behave. Once the date from a directory name is removed, it seems safe to assume that further nested parts of the path will descend as so.
So, in conclusion, I get what you’re saying and I’ve never in the past needed sections nested within pages, but now that I’ve built a commenting system I do. (See: https://spenc.es/writing/email-as-a-commenting-system/#comments)
PS: Also individual comments as pages would allow taxonomies based on the author of the comment, in addition to pagination.
I also forgot to mention that I submitted a PR for this already, but that was when we thought it was a bug. https://github.com/getzola/zola/pull/2369
If you allow it then, I assume as a feature there might be more requirements and tests added. I’m happy to do the work but I’m missing all the context @Keats has.
If we allow something like that, it should be a more general change, something like https://zola.discourse.group/t/proposal-deprecate-sections/1968