gpt4 book ai didi

javascript - baseurl 在 Jekyll 中不起作用

转载 作者:行者123 更新时间:2023-11-28 10:08:11 25 4
gpt4 key购买 nike

我试图在“myaccount.github.io/Templates”中创建一个 github 页面。在使用 Jekyll 时,我设置了 baseurl :/templates 但是当访问上面的链接时,JS 和 css 文件没有加载。 head.html 是这样的(包含在主页中):

<head>
<link href="http://gmpg.org/xfn/11" rel="profile">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<!-- Enable responsiveness on mobile devices-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

<title>
{% if page.title == "Home" %}
{{ site.title }} &middot; {{ site.tagline }}
{% else %}
{{ page.title }} &middot; {{ site.title }}
{% endif %}
</title>

<!-- CSS -->
<link rel="stylesheet" href="{{ site.baseurl }}public/css/poole.css">
<link rel="stylesheet" href="{{ site.baseurl }}public/css/syntax.css">
<link rel="stylesheet" href="{{ site.baseurl }}public/css/hyde.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">

<!-- Icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{{ site.baseurl }}public/apple-touch-icon-144-precomposed.png">
<link rel="shortcut icon" href="{{ site.baseurl }}public/favicon.ico">

<!-- RSS -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">
</head>

index.html:

---
layout: default
title: Home
---

<div class="posts">
{% for post in paginator.posts %}
<div class="post">
<h1 class="post-title">
<a href="{{ post.url }}">
{{ post.title }}
</a>
</h1>

<span class="post-date">{{ post.date | date_to_string }}</span>

{{ post.content }}
</div>
{% endfor %}
</div>

<div class="pagination">
{% if paginator.next_page %}
<a class="pagination-item older" href="{{ site.baseurl }}page{{paginator.next_page}}">Older</a>
{% else %}
<span class="pagination-item older">Older</span>
{% endif %}
{% if paginator.previous_page %}
{% if paginator.page == 2 %}
<a class="pagination-item newer" href="{{ site.baseurl }}">Newer</a>
{% else %}
<a class="pagination-item newer" href="{{ site.baseurl }}page{{paginator.previous_page}}">Newer</a>
{% endif %}
{% else %}
<span class="pagination-item newer">Newer</span>
{% endif %}
</div>

布局:(default.html)

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">

{% include head.html %}

<body>

{% include sidebar.html %}

<div class="content container">
{{ content }}
</div>

</body>
</html>

我不明白为什么没有加载 css 文件!

最佳答案

如果您的网址是 myaccount.github.io/Templates,那么您的基本网址是:

baseurl: "/Templates" # Uppercase T

关于javascript - baseurl 在 Jekyll 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24474047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com