Hi,
I’ve just had a go at hexo and bootstrapped a little blog at tomek.wiszniewski.cc with it. So far I’m loving every bit of it! :+1: for your great work!
One thing that struck me though is the post slug generated by default. When I run hexo new draft 'How CSS unit tests boost our productivity', I’d expect a slug like /how-css-unit-tests-boost-our-productivity. Instead, I get /How-CSS-unit-tests-boost-our-productivity. I’m not used to seeing a mix of uppercase and lowercase letters in URLs anywhere except Wikipedia (who designed their URLs a good decade ago).
I think lowercase slugs is what most of us want. Why not make it the default? What do you think?
The url just follow the name of md file you create.
And from my opinion, it doesn't metter as the browsr will miss the difference between a W and w
The browser sends it in the request. Probably most servers ignore the case in paths or at least redirect you to the right path when you make a case-typo. But the ugly mix of lower- and uppercase letters will still be what the user sees in the address bar and in links.
Hello there!
And from my opinion, it doesn't metter as the browsr will miss the difference between a W and w
Well, except for the scheme and host part, the rest of an HTTP(S) URI is case-sensitive (cf. RFC7230 §2.7.3).
In my case, Hexo is generating URIs as described by @tomekwi , which sadly do not play well with things like doctoc.
I have tried adding this to my _config.yml:
marked:
modifyAnchors: 1
as per this page, but to no avail. ☹
Any ideas?
And from my opinion, it doesn't metter as the browsr will miss the difference between a W and w
I haven't checked this specifically, but on Linux the filesystem is case sensitive. So for apache running on Linux path containing W and w will be different.
This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
For anyone out there wanting to have all-lowercase slugs, this is how to do it:
In the scripts file of your theme (e.g., theme/landscape/scripts), add a JavaScript file with the following content:
/* global hexo */
'use strict';
const path = require('path')
// If config.lowercase is set, convert post slugs to all lowercase.
hexo.extend.filter.register('new_post_path', function (data, replace) {
if (typeof data === 'string' && hexo.config.lowercase) {
data = path.dirname(data) + path.sep + path.basename(data).toLowerCase();
}
return data;
});
Somewhere in your site's _config.yml file, add:
lowercase: true
Now, when you create a new post, the slug will be all lowercase. For example:
hexo new post "This is a NEW post"
will yield something like:
INFO Created: ~/…/source/_posts/this-is-a-new-post.md
Hope this helps.
Most helpful comment
For anyone out there wanting to have all-lowercase slugs, this is how to do it:
In the
scriptsfile of your theme (e.g.,theme/landscape/scripts), add a JavaScript file with the following content:Somewhere in your site's
_config.ymlfile, add:Now, when you create a new post, the slug will be all lowercase. For example:
hexo new post "This is a NEW post"will yield something like:
Hope this helps.