Github 仅在某些目录中找不到页面 index.html

Github Pages cannot find index.html only in some directories

更新:我受够了,从头开始重新做所有事情,它会自行修复。

我有一个使用 Jekyll 和 Chirpy 主题构建的 github 页网站。

在本地,运行很棒。

然而,当部署在 Github 页面上时,有几个目录 return 404 页面,即使路径有效并且其中有一个 index.html 文件。

示例: https://catmandx.github.io/posts/Wgel-CTF-Writeup/正常显示 https://catmandx.github.io/tags/cmc/index.html returns 404 http://127.0.0.1:4000/tags/cmc/index.html 显示正确。

我已经临时制作了 repo public,它在这里:https://github.com/catmandx/catmandx.github.io

我已经敲了几个小时的头了。我尝试再次提交并推送到重新 运行 操作,手动编辑 gh-pages 分支中的 /tags/cmc/index.html 文件,但没有任何效果。

这是 _config.yml 文件,不确定是否有帮助,但在这里:

# The Site Settings
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT licensed


# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
# --------------------------
title: Hoang Nguyen                          # the main title

tagline: Simple Blog.  # it will display as the sub-title

description: >-                        # used by seo meta and the atom feed
  A minimal, portfolio, sidebar,
  bootstrap Jekyll theme with responsive web design
  and focuses on text presentation.

# fill in the base hostname & protocol for your site, e.g., 'https://username.github.io'
url: 'https://catmandx.github.io'

author: Hoang Nguyen              # change to your full name

avatar: /assets/img/avatar.jpg   # support internet resources

github:
  username: catmandx             # change to your github username

#twitter:
#  username: twitter_username            # change to your twitter username

social:
  name: Hoang Nguyen                  # it will shows as the copyright owner in Footer
  email: hhoang.nov.13@gmail.com             # change to your email address
  links:
    # The first element serves as the copyright owner's link
    # - https://twitter.com/username      # change to your twitter homepage
    - https://github.com/catmandx       # change to your github homepage
    # Uncomment below to add more social links
    - https://www.facebook.com/whohoi
    # - https://www.linkedin.com/in/username

# google_site_verification: google_meta_tag_verification # change to your verification string
# --------------------------


# Only if your site type is GitHub Project sites and doesn't have a custom domain,
# change below value to '/projectname'.
baseurl: ''

# Change to your timezone › http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Ho_Chi_Minh

google_analytics:
  id: ''          # Fill with your Google Analytics ID
  pv:
    # The Google Analytics pageviews switch.
    # DO NOT enable it unless you know how to deploy the Google Analytics superProxy.
    enabled: false
    # the next options only valid when `google_analytics.pv` is enabled.
    proxy_url: ''
    proxy_endpoint: ''
    cache: false  # pv data local cache, good for the users from GFW area.

disqus:
  comments: false  # boolean type, the global switch for posts comments.
  shortname: ''    # Fill with your Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname


# Prefer color scheme setting.
#
# Note: Keep empty will follow the system prefer color by default,
# and there will be a toggle to switch the theme between dark and light
# on the bottom left of the sidebar.
#
# Available options:
#
#     light  - Use the light color scheme
#
#     dark   - Use the dark color scheme
#
theme_mode:  # <light|dark>

# boolean type, the global switch for ToC in posts.
toc: true

paginate: 10

kramdown:
  syntax_highlighter: rouge
  syntax_highlighter_opts:   # Rouge Options › https://github.com/jneen/rouge#full-options
    css_class: highlight
    # default_lang: console
    span:
      line_numbers: false
    block:
      line_numbers: true
      start_line: 1

# DO NOT change this unless you're a Pro user on Jekyll and Web development,
# or you think you're smart enough to change other relevant URLs within this template.
permalink: /posts/:title/

collections:
  tabs:
    output: true
    sort_by: order


defaults:
  -
    scope:
      path: ''          # An empty string here means all files in the project
      type: posts
    values:
      layout: post
      comments: true    # Enable comments in posts.
      toc: true         # Display TOC column in posts.
      breadcrumb:
        -
          label: Posts
          url: /
  -
    scope:
      path: _drafts
    values:
      comments: false
  -
    scope:
      path: index.html
    values:
      breadcrumb:
        -
          label: Posts
  -
    scope:
      path: tags
    values:
      breadcrumb:
        -
          label: Home
          url: /
        -
          label: Tags
          url: /tabs/tags/
  -
    scope:
      path: categories
    values:
      breadcrumb:
        -
          label: Home
          url: /
        -
          label: Categories
          url: /tabs/categories/
  -
    scope:
      path: ''
      type: tabs             # see `site.collections`
    values:
      layout: page
      dynamic_title: true    # Hide title in mobile screens.
      breadcrumb:
        -
          label: Home
          url: /

sass:
  sass_dir: /assets/css
  style: compressed

compress_html:
  clippings: all
  comments: all
  endings: all
  profile: false
  blanklines: false
  ignore:
    envs: []

exclude:
  - vendor
  - Gemfile.lock
  - Gemfile
  - tools
  - docs
  - README.md
  - LICENSE
  - example

jekyll-archives:
  enabled: [categories, tags]
  layouts:
    category: category
    tag: tag
  permalinks:
    tag: /tags/:name/
    category: /categories/:name/

更新:这是日志,如你所见,文件存在但是/categories和/tags中的所有子目录returns 404:

您可以通过执行 bash tools/init.sh

来解决这个问题

每次创建 category/tag 时,您还必须 运行 这个 init.sh。