Add short slugs

This commit is contained in:
Nathan McCarty 2025-02-06 20:22:40 -05:00
parent f74480a2b0
commit c60ce1efdf

View file

@ -57,9 +57,12 @@ method updated(--> DateTime:D) {
#| Get the list of slugs for this post, including ones auto generated from #| Get the list of slugs for this post, including ones auto generated from
#| the title, as well as any additional slugs #| the title, as well as any additional slugs
method all-slugs(--> Array[Str:D]) { method all-slugs(--> Array[Str:D]) {
my $long-title-slug = self.title.lc.trim.subst: /\h+/, '-', :g; my $title-words = self.title.lc.trim.words;
my $long-title-slug = $title-words.join('-');
my $six-word-slug = self.title.lc.words.head(6).join('-');
my Str:D @slugs = @!slugs.clone; my Str:D @slugs = @!slugs.clone;
@slugs.push($long-title-slug); @slugs.push($long-title-slug);
@slugs.push($six-word-slug);
@slugs; @slugs;
} }