gitlab上的fork jekyll不起作用 - 显示404页

发布于 2025-02-08 17:26:50 字数 488 浏览 1 评论 0原文

我正在使用Jekyll创建一个新的项目模板。新项目模板>选择Jekyll。

但是,当我运行CI/CD构建以服务页面时,

  • CSS页面有点混乱
  • 当我单击Jekyll帖子时,

,如下所示。网站上没有任何进一步的说明:我已经删除了叉子关系并按照指示启用了跑步者。 https://gitlab.com/pages/jekyll

有什么想法吗?

I am creating a new project template using Jekyll by doing > new project template > choose Jekyll.

However, when I run the CI/CD build to serve the pages

  • the CSS pages are kinda messed up
  • When I click on the Jekyll post it shows a 404 like below.

There aren't any further instructions in the site: I have already removed the fork relationship and enabled runners as per instructed. https://gitlab.com/pages/jekyll

Any idea why?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖伴 2025-02-15 17:26:50

请确保您正确设置urlbaseurl configs在_Config.yml文件中。

URL带有架构前缀的域名。例如:https://example.com

baseurl是指应在此处提供网站的子路径。它应该以/开始。例如:/blog/docs

# other config
url: "https://example.com"
baseurl: "/blog"
# other config

。在这种情况下,它将变为https://example.com/blog

但是,如果您使用的是自定义主题,则需要确保进行某些修复程序。

例如,如果您在不使用baseurl和URL的情况下引用资产,则需要修复它。

<script src="/assets/js/theme.js"></script>

应成为

<script src="{{ site.baseurl }}/assets/js/theme.js"></script>

如果子路径更改,

使用baseurl属性。同样,&lt; link&gt; in &lt; head&gt;

<link rel="stylesheet" href="/assets/css/theme.css">

在将托管在Github的根域上的站点移动到GitHub的一个站点时,将

<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/theme.css">

其工作起来,转到测试GitLab环境子路径。

如果您使用市场上的主题,那么可以已经配置了此内容,并且您可以使用urlbaseurl config _config.yml config >。

Please make sure you are correctly setting up url and baseurl configs in the _config.yml file.

The url refers to the domain name with schema prefix. For example: https://example.com.

The baseurl refers to the sub-path from where your site should be served. It should start with /. For example: /blog, /docs, etc.

_config.yml

# other config
url: "https://example.com"
baseurl: "/blog"
# other config

This lets the theme know where you want to serve the site from. In this case it becomes https://example.com/blog.

But if you are using a custom theme, you need to make sure you do certain fixes.

For example, if you are referencing assets without using baseurl and url you need to fix it.

<script src="/assets/js/theme.js"></script>

should become

<script src="{{ site.baseurl }}/assets/js/theme.js"></script>

to utilise the baseurl property if the sub-path changes.

Similarly, <link> in <head>:

<link rel="stylesheet" href="/assets/css/theme.css">

becomes

<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/theme.css">

This worked for me while moving a site hosted on a root domain at GitHub, to a test GitLab environment on a sub-path.

If you use a theme from the marketplace then this thing could already be configured and you can go ahead just with url and baseurl config in _config.yml.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文