Problem
After executing hexo g
, the index files for all my posts have the wrong img and meta tags:
For example, this is what hexo generated:
<meta property="og:image" content="https://xxx.github.io/.com//06/02/xxx/xxx.png">
...
<img src="/.com//06/02/xxx/xxx.png" ...>
But it should be:
<meta property="og:image" content="https://xxx.github.io/2020/06/02/xxx/xxx.png">
...
<img src="/2020/06/02/xxx/xxx.png" ...>
So somehow the year
property becomes .com/
PS: somehow the "og:url" tag is generated correctly in all index files. For example:
<meta property="og:url" content="2020/05/19/xxx/index.html">
Configurations I Have
_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
...
and the 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"
}
}
It seems that it was caused by the plugins "hexo-asset-image": "^1.0.0" and "hexo-asset-link": "^2.0.1".
It is solved by removing them from the package.json
file, and installing the plugin from https://github.com/cocowool/hexo-image-link.