Add aliases to all posts for old Hugo/Jekyll URL redirects

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python, r
Domain
web-dev

Research direction

Start by inspecting the frontmatter in posts/2013//index.md, posts/2019//index.qmd, and posts/2020/*/index.qmd, then apply the three alias cases to the remaining posts under posts/. Skip the 2026 cherry blossoms post, preserve existing aliases, and run quarto render; done means redirect HTML files appear under _site/YYYY/MM/DD/slug/index.html for the old URLs.

Written by the indexing model from the issue text.

Description

Background

The site has gone through several CMS migrations:

  • Jekyll (2013–2014): URL pattern /YYYY/MM/DD/slug/
  • Hugo/blogdown (2015–2020): same URL pattern /YYYY/MM/DD/slug/
  • Quarto (current): URL pattern /posts/YYYY/YYYY-MM-DD-slug/

External sites link to the old URL format. For example, a Posit blog post links to:
https://chendaniely.github.io/2019/08/28/r-or-python-which-one-to-learn-first/

The current URL for that post is:
https://chendaniely.github.io/posts/2019/2019-08-28-r-or-python-which-one-to-learn-first/

Solution

Quarto supports an aliases: field in post frontmatter that generates HTML redirect pages at the listed paths. Add the old-style URL as an alias to every post.

Example — add to posts/2019/2019-08-28-r-or-python-which-one-to-learn-first/index.qmd:

aliases:
  - /2019/08/28/r-or-python-which-one-to-learn-first/

Implementation

All 62 posts (2013–2020 + 2026) live under posts/ as index.md or index.qmd.
The old alias URL is always /YYYY/MM/DD/slug/ and can be derived in one of three ways depending on what frontmatter the post has:

Case 1 — Has permalink: (2 posts, both in 2013)

Use the permalink: value directly as the alias.

# existing
permalink: /2013/02/21/setting-up-virtualbox/
# add
aliases:
  - /2013/02/21/setting-up-virtualbox/

Files: posts/2013/*/index.md

Case 2 — Has slug: + date: (11 posts, 2019–2020 Rmd→qmd conversions)

Derive the alias from date: 'YYYY-MM-DD' + slug: some-slug-value:
→ alias = /YYYY/MM/DD/some-slug-value/

Some slugs are empty (slug: []) — for those, derive the slug from the folder name
(strip the YYYY-MM-DD- prefix from the folder name).

Files: posts/2019/*/index.qmd, posts/2020/*/index.qmd

Case 3 — Has neither permalink: nor slug: (48 posts, 2014–2018)

Derive alias entirely from the folder name.
Folder: posts/YYYY/YYYY-MM-DD-some-slug/
→ Parse date as YYYY/MM/DD, slug as everything after YYYY-MM-DD-
→ alias = /YYYY/MM/DD/some-slug/

Script approach

A Python or R script can handle all three cases:

  1. Walk every posts/YYYY/*/index.* file
  2. Parse the YAML frontmatter
  3. Determine the alias URL via the case logic above
  4. Inject aliases: [/YYYY/MM/DD/slug/] into the frontmatter if not already present
  5. Write back the file

The PyYAML or yaml R package can parse/write the frontmatter.
Alternatively a sed/awk script can do it since the frontmatter is always at the top between --- delimiters.

Notes

  • The 2026 cherry blossoms post (posts/2026/) has no old URL — skip it
  • Some 2016–2018 posts use underscores in folder names (e.g. 2016-08-31-a_simple_model_of_global_cascades_on_random_networks) — the old Hugo URL used the same underscore slug, so the derived alias should match
  • After adding aliases, run quarto render to confirm the redirect HTML files are generated under _site/YYYY/MM/DD/slug/index.html
Dominant language
SCSS
Stars
6
Forks
6
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from chendaniely/chendaniely.github.io

All issues in chendaniely/chendaniely.github.io

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.