Jieiku / abridge

Fast & Lightweight Zola Theme
https://abridge.pages.dev/
MIT License
166 stars 44 forks source link

Contents of blog/ in the homepage (content/_index.md) #168

Closed samueloph closed 5 months ago

samueloph commented 5 months ago

Looks like the main index at content/_index.md gets populated with the posts that are kept under archive/.

I've disabled the archive and kept only blog/, since I want the posts to be namespaced: https://github.com/samueloph/samueloph.github.io/blob/eccfd1c4b96dd67c6d662acebb8bb2ab3c156d43/config.toml#L81-L83

But then the homepage ends up empty. As a workaround I setup a redirect to blog/ but that means every access gets a redirect by default.

Is there a way to have the contents of blog to show up in the homepage?

Jieiku commented 5 months ago

The Abridge demo has a blog "section"

https://abridge.netlify.app/blog/

This was tackled here: https://github.com/Jieiku/abridge/issues/128#issuecomment-1640844439 (I just noticed you opened that one too)

You will see that the blog section is an empty page in the demo, but that is only because the theme does not have any content stored in the blog directory, but If I move content to that directory then it would appear.

Also Take a look at the solution proposed by cskwrd in this thread: https://github.com/Jieiku/abridge/issues/97

2024-04-17_12-55-25

2024-04-17_12-56-08

2024-04-17_12-57-26

samueloph commented 5 months ago

Thank you for the quick response!!!

The contents under blog/ are showing up fine when accessing that route, but on the main page I still get nothing. Looks like there's something blocking their contents of appearing at the root index.

In the example you showed, do you get anything on the homepage?

Here's what I have: Screenshot from 2024-04-17 21-13-33

While the page blog/ looks fine: Screenshot from 2024-04-17 21-13-38

The screenshots above are from the same website, with these settings: Screenshot from 2024-04-17 21-10-56 Screenshot from 2024-04-17 21-11-33 Screenshot from 2024-04-17 21-13-03

So in other words, I'm looking for how to get the blog/ posts to also show up at the root index.

Jieiku commented 5 months ago

If I move the content from the main content directory to under /blog then yes the main index is blank.

You can solve this by turning /blog into a transparent section, which makes all of the content of /blog available under the main site index.

You would do this here: your_site/content/blog/_index.md

instead of this:

+++
paginate_by = 3
sort_by = "date"
template = "index.html"
+++

set to this:

+++
transparent = true
+++

I would read over this thread as it is very similar: https://github.com/Jieiku/abridge/issues/97

EDIT: I am not however sure how to make the content appear at both locations. cskwrd set the section to not be rendered which would work, however if your wanting to do something different then it may be a limitation of Zola, in which case either you or I could open a thread over there to see if this is possible.

Jieiku commented 5 months ago

I was just thinking over this in my head. In the case of wanting content to appear at both /blog and the main index.

I think one way to do what your wanting, if transparent section is not what your looking for. Is to modify the Template for the main site index to also include specified sections.

I think this is how tabi displays content from "blog" on their main home page: https://welpo.github.io/tabi/

If that is the solution your looking for (take a look at their demo and see if it is) then let me know.

Jieiku commented 5 months ago

I just looked back on an issue here https://github.com/Jieiku/abridge/issues/129 so I do believe it should be possible, so let me know if a transparent section is not what your looking for and I will review this again, my memory on it is a bit fuzzy.

The one thing I am not sure about with the tabi demo is if pagination is also possible on the index, notice there is simply an all posts button at the bottom, which leads me to believe that his template simply loops over the content in the blog section and displays a certain number of them. (and then the real pagination takes place under the blog section)

by making blog a transparent section, the pagination works, as it is a built in feature of zola.

samueloph commented 5 months ago

Looks like I just needed to set blog/_index.md to transparent, I initially thought that would remove the blog/ prefix from the URLs but that's not the case.

https://github.com/samueloph/samueloph.github.io/commit/eac9dd1cb77d839327fea218f05bdf05f8261cc8

Thank you!