【问题标题】:Use other than index.html for Github pages将 index.html 以外的其他内容用于 Github 页面
【发布时间】:2015-02-04 11:12:47
【问题描述】:

我最近开始使用 github 页面,到目前为止,我使用默认 index.html 作为我的主页。如何使用另一个页面作为我的默认页面?例如,如果在我的 gh-pages 分支中,我的 html 在文件夹 src/ 中。如何将 ./src/index.html 设置为默认而不是 ./index.html?

【问题讨论】:

  • 您尝试了符号链接吗?

标签: github hosting github-pages


【解决方案1】:

创建虚拟 index.html 并将其放在标题中

<meta http-equiv="refresh" content="0; url=http://mysite.github.io/folder/index.html" />

http://mysite.github.io/folder/index.html 更改为您想要的网址。

【讨论】:

  • 加载主页不会需要更多时间吗? (因为重定向)
【解决方案2】:

虽然Steven Penny's comment 很好,但在 Windows 上,在 git 中创建符号链接并不是非常简单。只有更新版本的 git-for-windows support symlinks

如果您通过 core.symlinks 配置变量启用支持,您可以通过 mklink index.html src\file.html 和 gh-pages 将 file.html 显示为登录页面。

【讨论】:

    猜你喜欢
    • 2019-02-21
    • 1970-01-01
    • 2018-10-25
    • 1970-01-01
    • 2021-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多