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

Add ability to sort speakers (and maybe also organizers) on pages #9826

Open
mattstratton opened this issue Jun 26, 2020 · 9 comments
Open

Comments

@mattstratton
Copy link
Member

Folks have asked for the ability to adjust the order of speakers on the Speakers page. I think I can look into providing this ability in the theme refactor.

First guess is that we could do it one of two ways:

Frontmatter on speakers.md

In this case, there is a new, optional frontmatter element added to the speakers.md content file. This would list all the speakers in the order preferred.

If this element is detected, instead of spinning through files to find the speakers, it would only use this list, but in that order. The downside of this is that if someone sets this, but add speakers later and forget to update it, they won't show up. But since this is an optional thing and I feel like we would kind of "not advertise" it, most folks won't use it anyway.

So it would look like this:

+++
Title = "Speakers"
Type = "speakers"
Description = "Speakers for devopsdays Chicago 2020"
Speakers = ["michael-bluth", "tobias-fuenke", "lindsay-bluth", "george-michael-bluth"]
+++

(for organizers, a similar frontmatter element of Organizers = ["",""] would be added to the contact.md file for the event)

Frontmatter in speakers/firstname-lastname.md

For this method, each speaker (or organizer[1]) file would have an optional "sort" parameter in their frontmatter, and when we range to get those pages, we sort based on that value.

So it looks like this

+++
Title = "Jeff Smith"
Twitter = "DarkAndNerdy"
image = "jeff-smith.jpg"
type = "speaker"
linktitle = "jeff-smith"
website = "http://www.allthingsdork.com"
Sort = 5
+++

I like this one a lot less, as it's much harder to reason about.


[1] - in the theme refactor, every organizer has a file like organizers/firstname-lastname.md instead of being in a data yaml file, fyi

@mattstratton mattstratton added this to To do in Theme 2.0 via automation Jun 26, 2020
@toshywoshy
Copy link
Contributor

Why not use the weights that Hugo already implements?

@mattstratton
Copy link
Member Author

Can you be more specific?

@mattstratton
Copy link
Member Author

Ah you mean this

the speaker pages aren’t really in a collection in that way, and it doesn’t solve for organizers though. But we might as well use the existing framework for the front matter field and could make the code slightly easier to implement

@toshywoshy
Copy link
Contributor

That is what I was just looking up.
Yes, this does require using lists and singles in the theme, you would then be able to generate a list page with all speakers and a single page with that speaker specifically

@mattstratton
Copy link
Member Author

Is it probably not a bad idea to use a list template for speakers, the tricky thing is that it changes the page type for speaker pages that already exist so there would be a small maintenance task to go back and change that on all those

@mattstratton
Copy link
Member Author

Off the top of my head, doing it, this way would actually probably also help on some data lookups that were currently doing if we are treating speakers as a list, rather than just a bunch of pages!

@mattstratton
Copy link
Member Author

Since I’m not doing the big theme, refractor anymore, making a small change to have Organizers be individual pages instead of being in the data file would be a good thing to put as a small change by itself, we would have to have backwards compatibility for the old way, but I think it’s quite doable

@toshywoshy
Copy link
Contributor

Yes, having json outputs for API like usage has been very helpful in the other HugoIO websites I have build.

I will see what I can do to help out.

@mattstratton
Copy link
Member Author

Created #13756 for the speaker type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Theme 2.0
  
To do
Development

No branches or pull requests

2 participants