Aller au contenu
  1. Documentation/

Adding events

4 mins

Event lists #

An event list page can be created and customized by creating or editing a directory in your content directory and adding a file named _index.md in that directory. Beware that the _ prefix to the file name is important for Hugo to consider this page as an index page. For instance, for this example site, we have a file content/events/_index.md. to setup this page for displaying events, the front matter of your _index.md should contain the key:

contentType: event

Like for any other page, the markdown content of the file will be rendered first, and then every other markdown file in the directory and recursively below will be considered as an event. Events are sorted by topics. By default, the main page interleaves events from all topics, sorted by date. Topics are listed on the side and clicking on a topic just lists the events for that topic. Each topic is a sub-directory with its own _index.md file. In that file, the front matter provides informations about the topic.

---
title: OptiCore
summary: Cabling processors with fiber optics
params:
    category: 01-Scientific Meetings
contentType: event
---

The Opticore meetings aims at sharing knowledge on fiber optics communications,
and how these can be used in modern processor architecture.

The params/category field is used to organize the topics in the main list page. A prefix is used for sorting the categories, and the category name is obtained by removing the prefix. For instance 01-Scientific Meetings will appear before 02-Transversal Meetings and the actual displayed category name will be Scientific Meetings. The markdown content of the topic _index.md file will be used for the specific topic page before listing its events.

The topic thumbnail can be provided by adding an image in the topic directory whose file name is prefixed by thumb.

Events #

Each event can be provided either as a markdown file in its topic directory, or as a directory with an index.md file. Using a directory is necessary to provide a thumbnail for the event, and associated files (slides, code archive and so on). The front matter of the markdown file or the index.md provides the event meta data. Below is an example of an event of the example site

---
date: 2024-07-22
title: "Differential Privacy for Mobile Data"
params:
  author: Fatima Hernández
  material:
    article: https://example.com/articles/dp-mobile-data
    slides: slides.pdf
    code: slides.tex
---

The minimum necessary data is a date and a title. The date will be used to sort the event with other events. In addition, author and additional material can be provided as in the example above. For additional material, the params/material map accepts arbitrary keys associated with an external url or a file name in the event directory. These will be translated into buttons below the events with the key as text and referencing the corresponding file or url.

By default, the event thumbnail is its topic thumbnail, but a custom thumbnail can be provided by adding an image whose file name is prefixed by thumb in the event directory.

Future events #

When adding events with a date in the future, by default these events will not appear in the lists. This is the default behavior in Hugo. To force the publication of a future event, add a publication date in the past for the event

publishDate: 2025-01-01

Events are categorized into Latest events and Upcoming events. Latest events are sorted by date, from the most recent, and paginated. By default, up to 3 upcoming events are displayed. This can be configured in the front matter of the _index.md list page you want the event to show. The number of upcoming events displayed can be configured using the upcomingSize front matter field. Use all to display every upcoming event.

upcomingSize: "all" #or a number 1, 2, 3, ...

Beware that upcoming events are not paginated. To completely remove upcoming events, you can provide a showUpcoming field set to false

showUpcoming: false