我创建了一个 Jekyll 站点,托管在 Netlify,位于old.address.com
. 现在我想重定向到new.address.com
. 但是 Netlify 文档似乎不起作用,或者我不理解这些文档。这就是我所做的:
我添加到_config.yml
:(因为 Netlify 说 Jekyll 排除了 '_...' 文件)
include:
- _redirects
我添加了一个_redirects
文件。我只是将 Netlify 生成的指令复制粘贴到该文件中,内容如下:
# Redirect domain aliases to primary domain
https://jekyll-comments.demo.ed.community/* https://jekyll-demo.talkyard.io/:splat 301!
http://jekyll-comments.demo.ed.community/* https://jekyll-demo.talkyard.io/:splat 301!
https://jekyll.demo.talkyard.io/* https://jekyll-demo.talkyard.io/:splat 301!
http://jekyll.demo.talkyard.io/* https://jekyll-demo.talkyard.io/:splat 301!
这没有任何效果。有什么问题/我做错了什么?
这是目录的样子:
$ ls -1
404.html
about.md
_config.yml
Gemfile
_includes
index.md
_layouts
_posts
_redirects <—— added as per Netlify's instructions
_sass
_site
$ ls -1 _posts/
2018-01-01-like-about-jekyll.markdown
2018-01-02-installation-instructions.markdown
2018-01-02-kind-creatures.markdown
配置文件只是默认的:
title: ...
email: ...
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: ...
github_username: ...
# Build settings
markdown: kramdown
theme: minima
plugins:
- jekyll-feed
talkyard_comments_server_url: ...
include:
- _redirects
请注意,虽然上面有相当多的细节,但这只是各种默认的东西。所以它不是特定于我的问题。它应该适用于所有新的 Jekyll 站点。