amp;quot;New Jekyll Pageamp;quot; not rendering default css.stylesheet : Only index.html works fine(新Jekyll页面不呈现默认css.style:仅index.html正常工作(amp;Quot;New Jekyll Pageamp;Quot;;Not))
问题描述
总的来说,我对Jekyll&;网页设计还是个新手。到目前为止,我一直遵循着如何使用Jekyll创建新页面的常规说明。从理论上讲,这一切听起来都相当简单。但在实践中,我遇到了理论上没有解释的问题。
下面我尽量做到描述性:
目录结构:
├── _includes
│ ├── footer.html
│ ├── head.html
│ ├── header.html
│ └── scripts.html
├── _layouts
│ └── default.html
├── _site
│ └── ...
│
├── css
│ └── style.css
├── fonts
│ └── ...
├── img
│ └── ...
├── js
│ └── ...
│
├──_config.yml
│
├──_gitignore.txt
│
├── CNAME
│
├── index.html
│
└── new_page.md
我到目前为止做了什么?
1)<link href="css/style.css" rel="stylesheet">添加到head.html:Chek!
结构<head>:
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{{ site.description }}">
<meta name="author" content="{{ site.author }}">
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/style.css" rel="stylesheet">
<!-- Add icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
</head>
2)_layouts文件夹中的default.html:Chek!
结构default.html:
<!DOCTYPE html>
<html lang="en">
{% include head.html %}
<!-- The #page-top ID is part of the scrolling feature - the data-spy and data-target are part of the built-in Bootstrap scrollspy function -->
<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">
{% include header.html %}
{{ content }}
{% include footer.html %}
{% include scripts.html %}
</body>
</html>
3)根目录中的index.html:chek!(主页运行正常!)
4)根目录中的new_page.md:chek!(css未呈现!)
已尝试new_page.html:也不工作:(
5)new_page.md:Chek中的YAML头条!
6)YAML封面中的布局链接到Default:Chek!
7)当我检查new_page url:http://127.0.0.1:4000/boilerplate/about/时,我注意到<head>完全具有指向css.style heet的链接。
结构_config.yml:
# ----------------------- #
# Main Configs #
# ----------------------- #
url: http://werkbaar.net
baseurl: /boilerplate/
title: WerkBaAr
email: aline@werkbaar.net
author: aline
description: > # ""
copyright:
credits: 'Credits: '
port: 4000
# ----------------------- #
# Jekyll & Plugins #
# ----------------------- #
plugins:
# - jekyll-seo-tag
# - jekyll-sitemap
# Build settings
markdown: kramdown
permalink: pretty
# ----------------------- #
# 3rd Party Settings #
# ----------------------- #
social:
- title: twitter
url:
- title: github
url:
- title: linkedin
url:
回购链接:https://github.com/bomengeduld/boilerplate/tree/gh-pages
实际网站链接:werkbaar.net
css
问题在于您如何在head.html推荐答案中包含css文件。行#12和#15:
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/style.css" rel="stylesheet">
它们使用的是相对路径,这意味着当您转到您站点的子文件夹(如werkbaar.net/about/)中的页面时,浏览器希望这些CSS文件分别位于werkbaar.net/about/css/bootstrap.min.css和werkbaar.net/about/css/style.css。
解决此问题的一种简单方法是在声明您的css文件时从/开始,这样您就告诉浏览器从您网站的根目录开始。
例如
<!-- Bootstrap Core CSS -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="/css/style.css" rel="stylesheet">
这篇关于新Jekyll页面不呈现默认css.style:仅index.html正常工作(&;Quot;New Jekyll Page&;Quot;;Not)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:新Jekyll页面不呈现默认css.style:仅index.html正常工作(&;Quot;New Jekyll Page&;Quot;;Not)
基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
