Aller au contenu
  1. Documentation/

Adding members

3 mins

Basics #

Pages listing persons 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/members/_index.md. to setup this page for displaying persons, the front matter of your _index.md should contain the key:

contentType: person

Members can be added as .md files in the directory, with member information in the file front matter. Examples are provided in the exampleSite in the content/members directory.

---
employers: [Université Lumière Lyon 2]
locations: [Blaise Pascal (INSA)]
params:
  category: 15-Engineers
  id: '1'
  name: Amara
  sort-key: Amara
  surname: Tsukuda
  webpage: null
statuses: ['Research Engineer']
title: Amara Tsukuda
---

Front matter can be specified in YAML, TOML or JSON, please refer to the Hugo documentation for more documentation on the subject. The YAML format is used in the above example. The provided template for members shows the following front matter fields, provided as free text, sometimes in arrays:

  • title: the member name
  • employers: in an array to handle multiple employers
  • locations: offices locations, also in an array
  • statuses: professor, PhD, …

Employers, locations and statuses are treated as taxonomy by Hugo, meaning that these will be used to automatically create pages for each employer, location and status and list the corresponding members.

Additional and optional information can be provided in a params map. To provide a thumbnail image for the user, an image file named after the params/id field should be provided in the same directory as the member.

Categories and sorting #

Members are organized into categories generated from the params/category field. The field is prefixed with a number used for the ordering of the categories, from small prefixes to big ones. For instance the category 15-Engineers appears after the category 10-Permanent members. The name of the category is extracted by removing the sorting prefix.

Within a category, members are sorted using the params/sort-key entry. As for categories, smaller keys appear first. In the above example, we chose to use the name as the sort-key, for alphabetical sorting.

When using import scripts, the categories are automatically derived according to a table defined in the import script, and the default sorting is alphabetic. Use manual overrides to manually tweak categories and sorting.

Merging with imported content #

When using import scripts to get users from the LIRIS databases, it is important to use the LIRIS user id as a file name to be able to merge manual content and imported content. If a file exists in the members directory, its content will override the matching imported fields in the import script.

When using the edit button on the website to edit a member, if no actual file exists (the user data is fully imported), a file with the correct name will be created.