leanprover / leanprover/verso

Allow blog posts to specify an explicit URL slug

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

Nobody has claimed this yet.

Dominant language
Lean
Stars
384
Forks
124
Avg merge
22h 28m
Merged PRs (30d)
10

Description

I have some posts with non-English titles, but I'd like their URLs to use short ASCII slugs. Currently the sulg is computed from the post title:

https://github.com/leanprover/verso/blob/ffd58ff11562c7af8698dac150f3a04d559ab201/src/verso-blog/VersoBlog/Basic.lean#L222-L231

While overriding postName can customize the generated name, it only gets the date and title, so the slug has to live somewhere else. And more importantly, Config now seems to be an internal thing:

https://github.com/leanprover/verso/blob/ffd58ff11562c7af8698dac150f3a04d559ab201/src/verso-blog/VersoBlog.lean#L843-L849

There's no way to pass it as argument, so I'm not sure how to modify postName.

I thought it would be nice to add an optional slug to Post.Meta, so this would get /blog/1980-01-01-test/ naturally:

#doc (Post) "测试" =>

%%%
authors := ["foo"]
date := { year := 1980, month := 1, day := 1 }
slug := "test"
%%%

But I'm not sure if there's already a good way to extend post metadata downstream (without defining a new blog genre).

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.

Research direction

Read the slug generation in src/verso-blog/VersoBlog/Basic.lean#L222-L231 and the Config definition in src/verso-blog/VersoBlog.lean#L843-L849. Trace how Post.Meta is parsed and how postName receives metadata, then determine how an optional slug can produce the requested ASCII URL while remaining usable by downstream blog authors.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.