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

How to generate list page for all presentations #37

Closed
kerma opened this issue May 24, 2019 · 11 comments
Closed

How to generate list page for all presentations #37

kerma opened this issue May 24, 2019 · 11 comments

Comments

@kerma
Copy link

kerma commented May 24, 2019

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?

@joshed-io
Copy link
Owner

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.

@kerma
Copy link
Author

kerma commented May 24, 2019

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.

@joshed-io
Copy link
Owner

joshed-io commented May 24, 2019 via email

@kerma
Copy link
Author

kerma commented May 24, 2019

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.

@kerma
Copy link
Author

kerma commented May 24, 2019

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.

@joshed-io
Copy link
Owner

@kerma Thanks for sharing what worked for you. I'll add this to the documentation.

@mayankguptadotcom
Copy link

@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?

@joshed-io
Copy link
Owner

@mayankguptadotcom Good question(s). @jerdog @davidovich do you have any thoughts/insight here?

@jerdog
Copy link
Contributor

jerdog commented Jan 21, 2024

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/)

@mayankguptadotcom
Copy link

@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

@jt-nti
Copy link

jt-nti commented Feb 5, 2024

@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.

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

5 participants