diff --git a/bin/create_hugo_pages.py b/bin/create_hugo_pages.py index 4cffdaaccd..161d576d6b 100755 --- a/bin/create_hugo_pages.py +++ b/bin/create_hugo_pages.py @@ -132,7 +132,9 @@ def create_people(srcdir, clean=False): data = yaml.load(f, Loader=Loader) # Create a page stub for each person for name, entry in data.items(): - person_dir = "{}/content/people/{}".format(srcdir, name[0]) + person_dir = "{}/content/people/{}/{}".format( + srcdir, entry["slug"][0], entry["slug"] + ) if not os.path.exists(person_dir): os.makedirs(person_dir) yaml_data = {"name": name, "title": entry["full"], "lastname": entry["last"]} diff --git a/bin/create_hugo_yaml.py b/bin/create_hugo_yaml.py index c58bf95aa0..a606873ec8 100755 --- a/bin/create_hugo_yaml.py +++ b/bin/create_hugo_yaml.py @@ -30,6 +30,7 @@ from docopt import docopt from collections import defaultdict +from slugify import slugify from tqdm import tqdm import logging as log import os @@ -90,7 +91,7 @@ def export_anthology(anthology, outdir, clean=False, dryrun=False): name = anthology.people.get_canonical_name(id_) log.debug("export_anthology: processing person '{}'".format(repr(name))) data = name.as_dict() - data["slug"] = id_ + data["slug"] = slugify(repr(name)) or "NONE" if id_ in anthology.people.comments: data["comment"] = anthology.people.comments[id_] if id_ in anthology.people.similar: diff --git a/data/yaml/name_variants.yaml b/data/yaml/name_variants.yaml index 6073862bd3..ee74afdb71 100644 --- a/data/yaml/name_variants.yaml +++ b/data/yaml/name_variants.yaml @@ -7531,6 +7531,8 @@ - canonical: {first: Bruce, last: Porter} variants: - {first: Bruce W., last: Porter} +- canonical: {first: Matt, last: Post} + id: 0000-0002-1297-6794 - canonical: {first: Oana, last: Postolache} variants: - {first: Oana-Diana, last: Postolache} diff --git a/hugo/layouts/partials/author_link.html b/hugo/layouts/partials/author_link.html index 9c8c2669d0..4615fb490f 100644 --- a/hugo/layouts/partials/author_link.html +++ b/hugo/layouts/partials/author_link.html @@ -8,7 +8,8 @@ - person: A dict with key "id" (the ID of the person to link to, e.g., "hector-martinez-alonso"), and optional key "full" (a variant spelling) - class (optional): CSS classes for the link */}} -{{ $first_letter := slicestr .person.id 0 1 }} -{{ $entry := index .ctx.Site.Data.people $first_letter .person.id }} -{{ $link_to := printf "/people/%s/%s.md" $first_letter .person.id }} +{{ $id_first_letter := slicestr .person.id 0 1 }} +{{ $entry := index .ctx.Site.Data.people $id_first_letter .person.id }} +{{ $name_first_letter := slicestr $entry.slug 0 1 }} +{{ $link_to := printf "/people/%s/%s/%s.md" $name_first_letter $entry.slug .person.id }} {{ if isset .person "full" }}{{ .person.full }}{{ else }}{{ $entry.full }}{{ end }}