Add short slugs
This commit is contained in:
parent
f74480a2b0
commit
c60ce1efdf
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue