Hexo: meta 和 img 标签地址错误
Hexo: wrong address for meta and img tags
问题
执行 hexo g
后,我所有帖子的索引文件都有 错误的 img 和 meta 标签:
例如hexo生成的是这样的:
<meta property="og:image" content="https://xxx.github.io/.com//06/02/xxx/xxx.png">
...
<img src="/.com//06/02/xxx/xxx.png" ...>
但应该是:
<meta property="og:image" content="https://xxx.github.io/2020/06/02/xxx/xxx.png">
...
<img src="/2020/06/02/xxx/xxx.png" ...>
所以不知何故 year
属性 变成了 .com/
PS:在所有索引文件中正确生成“og:url”标签。例如:
<meta property="og:url" content="2020/05/19/xxx/index.html">
我的配置
_config.yml:
# Site
title: XXX
subtitle: XXX
description: ''
keywords:
author: XXX
language: en
timezone: ''
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://xxx.github.io
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks
...
post_asset_folder: true
relative_link: false
...
和 package.json:
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"hexo": {
"version": "4.2.1"
},
"dependencies": {
"hexo": "^4.2.1",
"hexo-asset-image": "^1.0.0",
"hexo-asset-link": "^2.0.1",
"hexo-deployer-git": "^2.1.0",
"hexo-generator-archive": "^1.0.0",
"hexo-generator-category": "^1.0.0",
"hexo-generator-index": "^1.0.0",
"hexo-generator-tag": "^1.0.0",
"hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^2.0.0",
"hexo-renderer-stylus": "^1.1.0",
"hexo-server": "^1.0.0"
}
}
好像是插件 "hexo-asset-image": "^1.0.0" 和 "hexo-asset-link": "^2.0.1".
通过从 package.json
文件中删除它们并从 https://github.com/cocowool/hexo-image-link 安装插件来解决。
问题
执行 hexo g
后,我所有帖子的索引文件都有 错误的 img 和 meta 标签:
例如hexo生成的是这样的:
<meta property="og:image" content="https://xxx.github.io/.com//06/02/xxx/xxx.png">
...
<img src="/.com//06/02/xxx/xxx.png" ...>
但应该是:
<meta property="og:image" content="https://xxx.github.io/2020/06/02/xxx/xxx.png">
...
<img src="/2020/06/02/xxx/xxx.png" ...>
所以不知何故 year
属性 变成了 .com/
PS:在所有索引文件中正确生成“og:url”标签。例如:
<meta property="og:url" content="2020/05/19/xxx/index.html">
我的配置
_config.yml:
# Site
title: XXX
subtitle: XXX
description: ''
keywords:
author: XXX
language: en
timezone: ''
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://xxx.github.io
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks
...
post_asset_folder: true
relative_link: false
...
和 package.json:
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"hexo": {
"version": "4.2.1"
},
"dependencies": {
"hexo": "^4.2.1",
"hexo-asset-image": "^1.0.0",
"hexo-asset-link": "^2.0.1",
"hexo-deployer-git": "^2.1.0",
"hexo-generator-archive": "^1.0.0",
"hexo-generator-category": "^1.0.0",
"hexo-generator-index": "^1.0.0",
"hexo-generator-tag": "^1.0.0",
"hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^2.0.0",
"hexo-renderer-stylus": "^1.1.0",
"hexo-server": "^1.0.0"
}
}
好像是插件 "hexo-asset-image": "^1.0.0" 和 "hexo-asset-link": "^2.0.1".
通过从 package.json
文件中删除它们并从 https://github.com/cocowool/hexo-image-link 安装插件来解决。