0

我正在尝试将我使用 jekyll 构建的网站部署到 gitlab 页面。但是,只有索引页面才能正确加载。所有其他链接都需要将 .html 附加到 url。所以

username.gitlab.io/project/

功能正常,但两者

username.gitlab.io/project/about
username.gitlab.io/project/blog

仅当 url 更改为

username.gitlab.io/project/about.html
username.gitlab.io/project/blog.html

奇怪的是,当部署在 github 页面上时,不需要修改 url

username.github.io/project/
username.github.io/project/about
username.github.io/project/blog/

一切正常。

我感觉它与 .gitlab-ci.yml 文件有关,但我不确定。这里是如果它有任何线索

image: ruby:2.5.3

variables:
  JEKYLL_ENV: production
  LC_ALL: C.UTF-8

before_script:
  - bundle install

test:
  stage: test
  script:
  - bundle exec jekyll build -d test
  artifacts:
    paths:
    - test
  except:
  - master

pages:
  stage: deploy
  script:
  - gem install jekyll
  - bundle exec jekyll build -d public
  artifacts:
    paths:
    - public
  only:
  - master
4

1 回答 1

1

您可以为 YAML 中的页面使用自定义永久链接,例如:permalinks: /project/about

我一直在使用 gitlab 在我的 Jekyll 博客托管中使用它,它似乎没有问题,尽管在每个页面上重复似乎有点乏味。

于 2018-12-23T03:36:02.970 回答