简体   繁体   中英

Jekyll does not create html page from markdown file

I'm new to Jekyll and build a webpage using the TeXt Theme. I downloaded all files and created a local Jekyll website which runs successfully. The project folder contains the folders

  • _data
  • _includes
  • _layouts
  • _posts
  • _sass
  • _site
  • assets
  • docker
  • docs
  • screenshots
  • test
  • tools

The rest of the files in the folder are _config.yml, index.html, etc.

Now let's say I want to create a new page "Bio" that appears as an entry or name in the navigation bar at the top of the website like "about" or "archive".

I create a.md-file in the main project folder (ie where index.html lies) and specify in the front matter the layout - in the case of TeXt it is

layout: page

Also, in the _data folder I open the navigation.yml and append under "header" a new title called "Bio", ie

header: 
    title: Bio 
    url: /Bio.html

This is completely analogue to the about-page that is in the navigation bar and works properly.

But when I do it like this with Bio I get a 404 error and Jekyll is not able to find the site.

I searched all folders of the project and found that Jekyll does not create the necessary.html-file Bio.html on the basis of Bio.md. It just moves Bio.md into _site.

Hence, the url given in the navigation.yml cannot be found and I get the error. How do I get Jekyll to create the Bio.html?

If Bio.md is just copied, that means that Jekyll thinks it's a static file.

You're certainly missing a correct Front matter .

Your Bio.md should look like:

---
layout: page
title: Bio
---
## Content here
...

If problem persists, please add a repository url to help debug.

I figured out the answer myself. It is the notorious UTF-8 BOM issue with Jekyll. The file Bio.md was written in Notepad which uses BOM by default. Using ANSI instead solved the problem entirely without changing anything at the previous front matter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM