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

Question: How to organize news feed items? #2513

Open
dubrowgn opened this issue Jun 1, 2024 · 4 comments
Open

Question: How to organize news feed items? #2513

dubrowgn opened this issue Jun 1, 2024 · 4 comments

Comments

@dubrowgn
Copy link

dubrowgn commented Jun 1, 2024

I'm working on porting my old PHP/SQL site to zola, and I really like the simplicity and speed so far. One thing I haven't figured out yet though, is how to handle/organize "sub-page" sized content. The root index of my site has a "news feed" (see https://dubrowgn.com). The data for these look a lot like a page, but several are rendered together in a paginated fashion. I don't want each one rendered in its own page.

What I tried is creating pages under content/news, and just rendering them via content/news/_index.md. The rendered output looks like what I want, but I want the content to show up as the root index (e.g. https://dubrowgn.com, not https://dubrowgn.com/news). I can't figure out how to do this without breaking the rest of the site. The section logic tries to include all the site contents instead of just stuff under content/news. I also can't figure out how to prevent the individual news items themselves from rendering (e.g. no https://dubrowgn.com/news/foo/index.html). I looked at using ignore_contents in config.toml, but then the content disappears completely. I tried setting render = false on the news items, but that didn't work either.

Another idea I had was to just call get_section(path="news/_index.md"), but I can't figure out how to do pagination with that. It also still tries to render the individual news item pages.

The only other potential solution I see is to (ab)use taxonomies somehow, but I would prefer not to have to manually "tag" all my news items. It still doesn't prevent rendering of individual news item pages either.

I've spent enough time at this point I figured maybe I should just ask. What's the best way to handle "sub-page" content in zola? Ideally, something that's nice to organize/maintain, doesn't render individual pages, handles pagination, and can be rendered to the site's root index.

Thanks!

@nwj
Copy link

nwj commented Sep 20, 2024

I think I have a similar use case and have also not figured out how to achieve this.

The general requirements are:

  • create a section that renders all of the content of its pages
  • Include the section's pages in an rss feed
  • BUT don't assign each page a unique url (and therefore, the pages would not be included in the sitemap either)

My specific for this is for a "/now" page (the section) that includes the full text of periodic updates (the pages). But I don't need or want the updates themselves to also have their own unique url.

My impression is that Zola doesn't support this, but perhaps someone here knows better?

@Keats
Copy link
Collaborator

Keats commented Sep 22, 2024

Would making the subsections transparent with render = false for the pages work?

@nwj
Copy link

nwj commented Sep 22, 2024

I tried something like that where I set render = false on each of the pages and then tried to build my section page this way:

{% for page in section.pages %}
  {{ page.content }}
{% endfor %}

But section.pages was empty in that case, I guess since render = false makes it so that the section doesn't include them in pages?

Regardless, I've kind of decided it's mostly fine to have each of these pages get their own unique url and I just won't link to them. Worst case it just means that they can be referred to individually by url even if that's not something I'm likely to need to do.

@Keats
Copy link
Collaborator

Keats commented Sep 23, 2024

There is #2585 that could solve that issue

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

No branches or pull requests

3 participants