Generate slug from post filenames

Rather than having Pandoc generate the id, which has the potential to change
over time and cause 404s, let's just generate the slug from the filename so
that the ids will never change.  This also solves the awkward question of
what the filename should be, since it was previously something arbitrary.

This mass rename was accomplished via this simple shell script:

  for p in *.meta; do
    slug=$( recsel -P slug "$p" | xargs basename )
    mv -v "${p/.meta/.md}" "${p:0:10}-$"

with minor manual tweaks where I saw fit.  Of course, now I have some pretty
long filenames, which is undesirable.

The next step is to compare it with the slugs currently on
and make them match.  That's the next commit, and should be pretty simple.
Mike Gerwitz 2019-01-08 01:07:25 -05:00
parent b182ea79b3
commit 9916ad55dc
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
84 changed files with 16 additions and 11 deletions

View File

@ -1,4 +1,7 @@
# The use of trademarks in free software has always been a curious and unclear concept to me, primarily due to my ignorance on the topic
# Trademarks in Free Software
The use of trademarks in free software has always been a curious and unclear
concept to me, primarily due to my ignorance on the topic.
Trademarks, unless abused, are intended to protect consumers' interests---are
they getting the brand that they think they're getting? If you download Firefox,

View File

@ -1,6 +1,6 @@
id: git-horror-story
type: post
ref: 2012-05-22-git-horror-story
ref: 2012-05-22-a-git-horror-story-repository-integrity-with-signed-commits
id: coope
type: latex
@ -14,7 +14,7 @@ pubdate: 2013-05-13
id: national-uproar
type: post
ref: 2013-06-10-national-uproar
ref: 2013-06-10-national-uproar-a-comprehensive-overview-of-the-nsa-leaks-and-revelations
id: gnu-kwindows
type: post
@ -22,20 +22,20 @@ ref: 2016-04-06-gnu-kwindows
id: gitlab-gitorious-freesw
type: post
ref: 2015-05-20-gitlab-gitorious-freesw
ref: 2015-05-20-gitlab-gitorious-and-free-software
id: copyleft-vs-community
type: post
ref: 2013-08-13-copyleft-vs-community
ref: 2013-08-13-freebsd-clang-and-gcc-copyleft-vs-community
id: re-fsf-waste-away
type: post
ref: 2013-01-26-re-fsf-waste-high-priority
ref: 2013-01-26-re-fsf-wastes-away-another-high-priority-project
id: vlc-lgpl
type: post
ref: 2012-11-17-vlc-lgpl
ref: 2012-11-17-vlcs-move-to-lgpl
id: re-skype-let-spy
type: post
ref: 2013-01-30-re-skype-let-spy
ref: 2013-01-30-re-who-does-skype-let-spy

View File

@ -50,9 +50,11 @@ main && /^<h1 / {
# Grab the generated id from the header and use it to
# generate a complete slug.
printf "slug: %s/%s\n", \
gensub( /^([0-9]+)-([0-9]+).*$/, "\\1/\\2", "", name[0] ), \
gensub( /^<h[^>]+ id="([^"]+)".*$/, "\\1", "" )
printf "slug: %s\n", \
gensub( /^([0-9]+)-([0-9]+)-[0-9]+-(.*)\.[a-z]+$/,
name[0] )
# Skip the date line immediately following the header and grab the first
# line of the abstract.