mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-01-31 07:16:17 +00:00
Fix tag slugs
This commit is contained in:
parent
810c43185b
commit
65e500799b
@ -3,6 +3,8 @@ const path = require('path');
|
|||||||
const { without } = require('lodash');
|
const { without } = require('lodash');
|
||||||
const { resolve, isCleanUrl } = require('./resolve');
|
const { resolve, isCleanUrl } = require('./resolve');
|
||||||
const Page = require('./page');
|
const Page = require('./page');
|
||||||
|
const slugs = require('slugify');
|
||||||
|
const slugify = (s) => slugs(s, { remove: /[*+~.,()'"!?:@/\\]/g }).toLowerCase();
|
||||||
const pkg = require(resolve('package.json'));
|
const pkg = require(resolve('package.json'));
|
||||||
|
|
||||||
const postmatch = /(\d{4}-\d\d-\d\d)\.\d{4}\.(\w+)/;
|
const postmatch = /(\d{4}-\d\d-\d\d)\.\d{4}\.(\w+)/;
|
||||||
@ -53,6 +55,11 @@ module.exports = exports = class Post extends Page {
|
|||||||
_parse (...args) {
|
_parse (...args) {
|
||||||
super._parse(...args);
|
super._parse(...args);
|
||||||
|
|
||||||
|
this.meta.tags = (this.meta.tags || []).reduce((result, tag) => {
|
||||||
|
result[slugify(tag)] = tag;
|
||||||
|
return result;
|
||||||
|
}, {});
|
||||||
|
|
||||||
this.classes.push('post');
|
this.classes.push('post');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user