Hexo自定义文章url地址
自定义文章 URL
先说说中文转义 URL 的方式,首先需要修改 hexo 根目录下的_config.yml 文件,
1 | #permalink: :year/:month/:title/ |
将原永久链接 permalink 中的 :title 替换为 urlname.html ,同时在 permalink_defaults 增加 urlname 属性,这样就可以通过在文章内容的 Formatter 配置文章的 URL 链接地址,笔者之前修改过一次永久链接格式,只保留了标题即:permalink: :title.html
,现在修改为了 permalink: :urlname.html
,本文文章配置如下图,
本文最终的 URL 地址就是:http://cato.eu.org/hexo-custom-article-url.html
修改文章模板
修改 post.md
1 | --- |
这样通过命令 hexo new xxxxxx
命令新建的博客文章中就自动带有这个属性。
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 猫偶的部落格!
评论