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

Need a way to treat a subdirectory as a new section, while rendering its index as a page #836

Open
jwatt opened this issue Oct 31, 2019 · 7 comments
Projects

Comments

@jwatt
Copy link
Contributor

jwatt commented Oct 31, 2019

If I have a site example.com and I want to have a page at example.com/about/, I probably want to run the index file in 'about' with my standard page template (not a section template). However, I do not want it to turn up in the section.pages of the top-level section.

As far as I can tell this isn't possible. If the about page is stored in about/index.md then it becomes a page of the top-level section. It's stored in about/_index.md then it's treated as a section and can't use the normal page template (object page doesn't exist, etc.). I've tried having the page in about/index.md and also having an about/_index.md containing just:

+++
render = true # also tried false
transparent = false
+++

in an effort to create a new section. But about/index.md still ends up in the pages object of the top-level section.

@Keats
Copy link
Collaborator

Keats commented Oct 31, 2019

As far as I can tell this isn't possible.

This isn't possible indeed but I think it's something worthwhile to add. We can now bikeshed the option name.

@jwatt
Copy link
Contributor Author

jwatt commented Oct 31, 2019

Cool. :) Maybe creates_new_section = true in index.md?

@rochacbruno
Copy link
Contributor

@jwatt @Keats I found a workaround for doing that as described here: getzola/hyde#22

I suggest a new option on content like:

+++
title = "about"
list_on_index = false  # will not be listed on section index.
+++

# About my site

sfsdfsdf

@philpax
Copy link
Contributor

philpax commented Dec 19, 2021

Hi there! Just wondering if this was implemented / there's a canonical solution.

I have a section blog that's transparent (so that its posts will show up in the root section, but the URLs will reside under /blog, as to maintain compatibility). However, this means that my about page is also in the root's section.pages, and will render in the root section's index.

I've side-stepped this issue by not including a date in the about page, so that Zola orphans it and doesn't include it in the date-sorted list, but it would be nice to do this without the warning on each build. I'd be happy with a way to purposefully orphan a page (without the warning) if that's possible 🙂

@Keats
Copy link
Collaborator

Keats commented Dec 19, 2021

No current optimal solution afaik.

@dubrowgn
Copy link

dubrowgn commented May 27, 2024

I would also love a solution to this. I want my root page to show paginated news items, and these are organized in a "news" sub-directory. I ended up doing the same as @philpax to avoid showing the rest of the site in the root page contents, but it's clunky and seems ripe for being accidentally broken by future "fixes".

Edit: Actually, that doesn't work either because zola just skips rendering the rest of my site altogether.

@hallettj
Copy link

I also want to have a page at /about that doesn't show up in the list of pages on my site's index page. The workaround I'm using for now is to put the "about" page in a section, and set the page path to make it show up at the URL I want. I have these files:

content/pages/_index.md
content/pages/about.md

The content of about.md looks like this:

+++
title = "About Me"
path = "about"
+++

Hi, here's a little about myself...

Technically that means I have an empty page at /pages (since I don't have any content in content/pages/_index.md, only some frontmatter configuration). But I don't have any links to that empty page, so I'm not worried about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
0.12
  
To do
Development

No branches or pull requests

6 participants