diff --git a/config/filters/index.js b/config/filters/index.js index df2f1607..152e66ec 100644 --- a/config/filters/index.js +++ b/config/filters/index.js @@ -46,6 +46,11 @@ export default { if (postType === 'featured') return shuffleArray(posts.filter(post => post.featured === true)).slice(0, 3) return posts.slice(0, 5) }, + slugifyPost: (title) => slugify(title, { + replacement: '-', + remove: /[#,&,+()$~%.'":*?<>{}\[\]\/\\|`!@\^\—]/g, + lower: true, + }), // watching featuredWatching: (watching, count) => shuffleArray(watching.filter(watch => watch.favorite === true)).slice(0, count), diff --git a/src/pages/main/posts/post.html b/src/pages/main/posts/post.html index 14c61454..e018501a 100644 --- a/src/pages/main/posts/post.html +++ b/src/pages/main/posts/post.html @@ -4,7 +4,7 @@ pagination: data: posts size: 1 alias: post -permalink: "/posts/{{ post.date | date: '%Y' }}/{{ post.title | slugify | downcase }}/index.html" +permalink: "/posts/{{ post.date | date: '%Y' }}/{{ post.title | slugifyPost }}/index.html" schema: blog --- {%- capture postUrl %}{{ meta.url }}{{ post.url }}{% endcapture -%}