-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get rid of index.html in URL #1306
Comments
I noticed this also. I edited the theme. That's how I 'sanitized' the path. - var regex = /(\/index\.html?$)|(\/?$)/;
- var path = article.path.replace(regex, '');
//-fix for permalink in pages
a(href=url_for(path))
+title(article) |
This feature is good to have. |
I ended up with a helper: hexo.extend.helper.register('page_url', function(path, options) {
return this.url_for(path, options).replace(/index\.html$/, '');
}); But internal settings would be better. |
I'm using this setting and not seeing permalink: :title/ |
I gave up with Hexo, so it’s irrelevant for me now. |
@fourpixels I’ve written my own simple generator and now I’m finally happy ;-) |
Hey, it looks interesting! Unfortunately I cannot use it right now as I'm in a big hurry and I need out of the box solutions for posts querying, categories, tags and all that crap :( Good luck with your generator! |
@fourpixels why not setting a helper, just like @sapegin did? |
@mef I already set |
|
Google crawler seems that sees these as duplicate. I think it would be better if we decide which use in all of hexo source code. Or add a new option for a user can select by themselves.
|
I do worry having Lines 52 to 58 in 651f34b
by adding following line after line 56: partial_url = partial_url.replace(/index\.html$/, ''); I concur on having an option. something like, if (config.canonical_url) {
partial_url = partial_url.replace(/index\.html$/, '');
} |
How about pages using another file name, like |
you mean when you set
just like theme-next/hexo-theme-next#866? The main concern of this PR is that permalink could be (I haven't try) "http://example.com/2018/08/20/test-title.html/index.html", the index.html shouldn't be there. If that config is set, then permalink should be "http://example.com/2018/08/20/test-title.html", as configured. As for hexo.extend.helper.register('canonical_tag', () => {
return '<link rel="canonical" href="' + post.permalink.replace(/\.html$/, '/') + '">';
}); Note the above codes needs to be refactored into this format to access |
Indeed, I was confused about the problem, you may disregard previous comment, thanks. |
hexo/lib/plugins/helper/open_graph.js Line 38 in b402da0
|
Is there any way to remove
index.html
from all links?The text was updated successfully, but these errors were encountered: