【问题标题】:Google Cloud Platform vs GitHub pages for Static Website - different handling of index.html谷歌云平台与静态网站的 GitHub 页面 - index.html 的不同处理
【发布时间】:2016-09-10 05:36:10
【问题描述】:

我正在考虑在 Google Cloud Platform (GCP) 或 GitHub Pages (GHP) 上托管我的静态网站(包括 Jekyll 博客)。我做了一个小测试,发现 GCP 处理 index.html 文件的方式与 GHP 不同。

假设我有以下文件结构:

- index.html
- folder
    - index.html
    - another.html
  1. 网址www.example.com/folder

GCP:重定向到 www.example.com/folder/index.html(不需要 index.html)

GHP:重定向到www.example.com/folder/(不是问题)

  1. 网址www.example.com/folder/(带有尾部正斜杠)

GCP 和 GHP:URL 保持为 www.example.com/folder/(期望行为)

第 1 种情况下 GCP 的行为是不受欢迎的。我不想在 URL 中看到 index.html。有没有办法解决这个问题,使其类似于 GHP 的工作方式?

【问题讨论】:

  • 这仍然是 GCP 上的问题吗?

标签: jekyll google-cloud-platform github-pages


【解决方案1】:

这个问题实际上似乎很容易解决。只需将您的固定链接更新为:

permalink: pretty

在你的 _config.yml 中

来源:https://github.com/jekyll/jekyll/issues/156

【讨论】:

  • 感谢您的回复。但是 Jekyll 永久链接需要 Web 服务器的支持。我已经试过了。它适用于 GitHub Pages,但不适用于 Google Cloud Platform。阅读关于永久链接的 Jekyll 文档,尤其是关于 Extensionless permalinks 的部分。
猜你喜欢
  • 2020-08-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-10
  • 2019-06-04
  • 1970-01-01
  • 1970-01-01
  • 2020-06-02
相关资源
最近更新 更多