Repository navigation
Conversation
pzhlkj6612
reviewed
Sep 13, 2026
pzhlkj6612
left a comment
Contributor
There was a problem hiding this comment.
指向站内资源的链接或许可以直接使用 {{ site.baseurl }} 而不是 {{ site.url }}{{ site.baseurl }}, 这样短一些。
Contributor
Author
感谢建议。我核对了一下,站内渲染两种写法完全等价。 本站 但是可能存在的风险:RSS。 |
- _config.yml: url 由 http://hibikilogy.github.io 改为 https://hibikilogy.github.io - 文章正文中的自站绝对 URL(439 处 / 31 个文件)统一改为 {{ site.url }}{{ site.baseurl }} - header-img 等 front matter 字段(14 处)改用根相对路径 /images/: 实测 Jekyll 不渲染 front matter 中的 Liquid,用变量会原样输出导致图片失效 - .github/workflows/path2url.yml: 替换目标不再是写死域名 (正文 → {{ site.url }}{{ site.baseurl }}/images/,front matter → /images/) - _includes/nav.html: 搜索范围 site:xxx 由 site.url 推导,不再写死域名
- _posts/**/*.md: 440 处 {{ site.url }}{{ site.baseurl }} 改为 {{ site.baseurl }}(图片 425 处 + 站内文章互链 15 处)
- .github/workflows/path2url.yml: sed 替换目标与文件头注释同步更新,避免自动化再次写回硬编码域名
- front matter 的 header-img、canonical、feed.xml、disqus_url、导航 site: 搜索保持绝对地址不变
h1s97x
force-pushed
the
fix/hardcoded-absolute-urls
branch
from
September 13, 2026 03:32
254d1ab to
9e21aab
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更内容
消除写死域名的站点绝对 URL,并把
site.url改为 HTTPS。1.
_config.ymlurl:http://hibikilogy.github.io→https://hibikilogy.github.io2. 文章正文(
_posts/**/*.md,440 处 / 40 个文件)https://hibikilogy.github.io→{{ site.url }}{{ site.baseurl }}→3. front matter 字段(14 处)
header-img: https://hibikilogy.github.io/images/...→header-img: /images/...header-img: "{{ site.url }}..."会原样输出、图片失效),因此 front matter 只能用根相对路径。
4.
.github/workflows/path2url.yml---到第二个---)→/images/{{ site.url }}{{ site.baseurl }}/images/5.
_includes/nav.htmlsite:hibikilogy.github.io→site:{{ site.url | replace: 'https://', '' | replace: 'http://', '' }}{{ site.baseurl }}验证
jekyll build通过,生产模式输出:https://hibikilogy.github.io/images/...header-img→/images/...feed.xml→https://hibikilogy.github.io/...site:hibikilogy.github.iocdn.jsdelivr.net/raw.githubusercontent.com等第三方托管地址。备注
_layouts/post.html存在硬编码,实际该文件并无硬编码;真正来源是.github/workflows/path2url.yml的 sed 替换(见关联 issue)。Fixes #97