【发布时间】:2021-04-21 15:51:45
【问题描述】:
我正在写我的个人博客。在本地使用 jekyll serve 时一切正常,但是当我想将其复制到我的网站时,所有帖子链接都引发了 404 错误。
经过调查,链接似乎错过了尾随的“.html”。这对 Jekyll 服务来说不是问题,但它不能远程工作。
这是我最初的 _config.yml,它适用于 jekyll serve
title: DonutBlog
author: DonutMan
#email: nobody@nowhere.org
description: >- # this means to ignore newlines until "baseurl:"
Des équations, des livres et du Shell
baseurl: "" # the subpath of your site, e.g. /blog
url: "http://blog.les-vigneron.fr" # the base hostname & protocol for your site, e.g. http://example.com
#twitter_username: jekyllrb
#github_username: jekyll
# Build settings
theme: minima
#plugins:
# - jekyll-feed
permalink: /:categories/:title
# added a page by category, following https://www.valhalla.fr/2017/10/16/jekyll-une-page-par-categorie/
collections:
category:
output: true # générer la page HTML
permalink: /:collection/:name/index.html
# exemple -> /category/informatique/index.html
主页在本地和外部访问都可以正常工作,但这里有一个链接示例,在本地工作正常,但在外部使用时会引发 404 错误:
http://blog.les-vigneron.fr/litterature/tous-les-mots-sont-freres
为了纠正这个问题,我在 _config.yml 的永久链接末尾添加了一个“.html”
permalink: /:categories/:title.html
现在所有的帖子链接看起来都是这样的:
http://blog.les-vigneron.fr/litterature/tous-les-mots-sont-freres.html
这与本地(jekyll 服务)和外部兼容,但我知道这是一个非常糟糕的 hack。
你知道我在这里错过了什么吗?
【问题讨论】:
标签: jekyll