How to generate list page for all presentations
kerma opened this issue · 11 comments
I'm trying to render a index page that would list links to all presentations. So far without much luck. This is the tree:
$ tree content
content
├── posts
│ ├── hello.md
│ └── second.md
└── slides
├── _index.md
└── presentation
└── _index.md
Atm I'm expecting that /slides/index.html
includes a link to /slides/presentation/
, but whatever I try, nothing seems to work. I only get an empty presentation there. Is this even supported?
Thanks for opening the issue. Can you share the Hugo code you're using to build the list of pages? There isn't anything that reveal-hugo does that would get in the way of using Hugo variables like Site and Page, so I'm thinking it's something there.
So reveal-hugo does not provide a list layout itself? I'm using Kiss theme for the main site. List page is generated with: https://github.com/ribice/kiss/blob/master/layouts/index.html
I get an empty Kiss list page when I leave _index.md
blank. Adding Outputs = ["Reveal"]
to meta generates an empty presentation.
That's what I suspected, thanks! I'll dive into template docs then and try to come up with some sort of solution for an example.
Got it working. But it's a bit tricky, so might be worth to document it somewhere. Figuring out the sections takes a while..
A working template:
<section class="section">
<div class="container">
<h1 class="title">{{ .Title }}</h1>
<div class="content">
{{ .Content }}
<ul>
{{ range sort .Sections}}
<li><a class="" href="{{ .Permalink }}">{{.Title}}</a>
</li>
{{ end }}
</ul>
</div>
</div>
</section>
Put it into layouts/slides/slidelist.html
. This now requires that _index.md
has layout set in the meta:
+++
layout = "slidelist"
+++
You cannot use section.html or list.html because that would break the reveal-hugo rendering of slides.
@kerma Thanks for sharing what worked for you. I'll add this to the documentation.
@kerma @dzello - i'm trying to generate a list of all the presentations and it's not working for me. I've followed the instructions to add the slidelist.html
Do we need to add the following layout to each and every presentations's frontmatter in _index.md?
+++
layout = "slidelist"
+++
Once this is added, where can we access the page with all the slides?
@dzello = is it possible to make this feature default, so that the homepage is always treated as the presentation listing page?
@mayankguptadotcom Good question(s). @jerdog @davidovich do you have any thoughts/insight here?
I've done it... I'm not at my laptop, but I'll try to get something written up soon
Sorry, just scrolled back through. I have no idea @mayankguptadotcom why this wouldn't be working for you. @kerma probably needs to add some thoughts here as they created this.
I did this myself manually by putting an _index.md
inside /content/home
per the docs and then linking to each sub-presentation with
* [15-min presentation](./15-min/)
* [20-min presentation](./20-min/)
* [30-min presentation](./30-min/)
@jerdog - same here i'm doing this manually for now too.
Even ChatGPT's solutions aren't helping in solving this :)
I'll keep at it, if I'll be able to make it work then will share the solution
@mayankguptadotcom do you have another theme configured in addition to reveal-hugo? I think that's what I needed to get things working. For example, I have this in my hugo.yaml
theme:
- hugo-flex
- github.com/dzello/reveal-hugo
I also don't have the extra, slides
level in the content which makes things a bit easier, e.g.
- content
- _index.md # Slide index
- ted-talk
- _index.md # beginning of the ted talk presentation
- body.md # appends to the ted talk presentation
- conclusion.md # appends to the ted talk presentation
That means I can use the home page template file, i.e. layouts/_default/home.html
, with @kerma's template example. There's no need to include a layout or outputs in the _index.md,— it just works.