jsantell / poet

A node.js blog engine
jsantell.github.io/poet
MIT License
605 stars 146 forks source link

Post slug handling issues #103

Open rygel opened 10 years ago

rygel commented 10 years ago

Hi,

I have found some issues with the slug handling.

Short explanation how I am using Poet: I am working on a small company website where I not only use Poet for the news section (= a blog), but also to power a set of products, a set of services and a set of career opportunities. So I have 4 separate instances in my application and it works great so far. However, because I am also using it to manage a set of products and services, I am very concerned about the URLs and need them to be in a specific way. Before the recent changes I could get away with defining the filenames of the markdown files. But now I have to define the slug myself inside of the markdown file. I like the new handling better, because now the filenames are not so important anymore. However, I found some issues with the slug handling.

  1. When defining a slug it will still be filtered and lowercased. I am not sure if this is intended? Because I was under the impression when I am defining the slug myself, I can decide how it looks like. And not being forced to all lowercase slugs.
  2. And more important for me. The filtering is not correct, because parentheses are removed from the slug, but they are allowed in URLs.

I fixed the second issue by changing the regex inside convertStringToSlug to include the parentheses: .replace(/[^\w- ()]+/g,'')

Alex

adam-beck commented 10 years ago

This was also mentioned at the end of #100