joeroe / risotto

A minimalist, responsive hugo theme inspired by terminal ricing aesthetics.
https://risotto.joeroe.io
MIT License
393 stars 109 forks source link

_index.md / index.md pages won't show TOC or Description #55

Closed jdcarls2 closed 1 year ago

jdcarls2 commented 1 year ago

With a page like /projects/some-project.md, setting toc: true adds a great Table of Contents in the sidebar. I love this.

But when I have a page like /projects/some-project/_index.md, the TOC does not render, even when set to true.

Edit to add: Page descriptions do not render in index pages either.

Why would this be?

joeroe commented 1 year ago

The table of contents and the description, author information etc. in the sidebar is part of risotto's single page template. But _index.md uses the list template, not a single page template.

I'm not sure that, in general, it makes sense to add the TOC/author metadata to list pages. Usually they are in themselves a kind of table of contents, and don't have one specific author. @jdcarls2 What's your intention in using /projects/some-project/_index.md instead of /projects/some-project.md? They should result in the same rendered URL.

However I can see that it would be nice to set a description for these pages.

Vinfall commented 1 year ago

Although a bit off-topic, I think you should also add page description to single page template instead of a site level description?

https://github.com/joeroe/risotto/blob/4343550d785d8cce942ac5109aa9fdd9d9a70823/layouts/partials/head.html#L2

Maybe something like this, I'm not sure whether the page description would just override the site one.

<!-- Site level -->
{{ with .Site.Params.about }}<meta name="description" content="{{ .description }}">{{ end }}
<!-- Page level -->
<meta name="description" content="{{ .Params.description }}">
jdcarls2 commented 1 year ago

@joeroe Honestly, it was my first time using any kind of static site generator, let alone a Hugo theme. The TOC / Author stuff was just me not totally understanding the intended organization of the site, and it makes total sense to me that an _index.md page would act as the TOC for its directory. But the description is a good add.