简体   繁体   English

如何在 Github Pages 中链接一个目录?

[英]How to have link of a directory in Github Pages?

Suppose I have in 1 file and 1 folder in my repository :-假设我的存储库中有 1 个文件和 1 个文件夹:-

  1. index.html索引.html
  2. folder文件夹

Folder contains again 1 file namely :文件夹再次包含 1 个文件,即:

  1. work.html工作.html

Now I want to open folder website with link only of现在我想打开只有链接的文件夹网站

username.github.io/repositoryname/folder

Not as不像

username.github.io/repositoryname/folder/work.html

Is there any way to achieve that ?有什么方法可以实现吗?

You can access username.github.io/repositoryname/folder/work.html from username.github.io/repositoryname/folder by adding a blank index.html file inside repositoryname/folder/ and adding the following line to it:您可以从username.github.io/repositoryname/folder访问username.github.io/repositoryname/folder/work.html通过在repositoryname/folder/添加一个空白的index.html文件并向其添加以下行:

<meta http-equiv="refresh" content="0" url="http://username.github.io/repositoryname/folder/work.html" />

Solution was originally posted by @DavidJacquel for a different issue (load main user site from a subfolder index.html ) but the approach should work with this issue too.解决方案最初由@DavidJacquel发布,用于解决不同的问题(从子文件夹index.html加载主用户站点),但该方法也适用于此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM