Closed awulkan closed 7 years ago
I originally added the category to prevent url coalition, I can fix it so that it doesn't break SEO and defaults to empty if undefined or null.
Maybe we can add configuration or something else to determine this? or if the post has an url property in front matter, we don't override it?
Another thing we can do is add variables to the url in frontmatter, so that if you do:
url: {$category}/why-gloria
we replace that with category
In my opinion it should default to empty if there is no category. I think most site owners don't want a category in their permalink.
One problem would be if you want to have categories, but don't want it to be in the permalink.
I think tjat the permalink structure needs to be separated. The best solution would probably be to have a setting in the config.yml for how the permalink should look. And then it could be overridden by specifying url in posts.
If you specified to include category in the permalink, but you didn't set a category it could default to "uncategorized", like most CMS do.
This might be difficult to implement though, but it would be a proper solution.
Just created #91, configuring the permalink can be done in the future.
Nice, so if there is no category metadata it will simply not fill in any category in the permalink?
So it would go from this:
example.com/blog/undefined/post-title
to this:
example.com/blog/post-title
Correct? I can't really check the code now since I'm on my phone.
yes, unless there's an url defined on the front-matter, it will just use the url.
so it can be:
/blog/[category]/title
or
/url
The category of a page gets added to the permalink by default. This is a bad idea since it makes it impossible to control the permalink structure, plus if I use any Swedish letter in the category, such as Å Ä Ö it also gets added, which makes it pretty bad for SEO and compatibility with countries that doesn't have those letters.
Also, there's a few more problems with it:
Examples: This http://localhost:3300/blog/åsna/first-post/ becomes this when copy/pasted: http://localhost:3300/blog/%C3%A5sna/first-post/
Empty category: http://localhost:3300/blog/null/first-post/
No category: http://localhost:3300/blog/undefined/first-post/