0
votes

Problem

Problem: I can't get a local build of my GitHub hosted website. My gh-pages branch on my local clone of my GitHub repo does not build right.

Specifically, markdown files don't build to the _site folder as html unless they start with the YAML frontmatter demarcation (--- newline ---), and when I serve them on localhost they don't pickup any CSS, I can't really preview what it will look like on GitHub. If the frontmatter demarcation is not in the markdown file it is copied to the _site folder as markdown.

You can see below I have two markdown files ideas.md and local-jekyll-build-theme-trouble.md.

ideas.md has the frontmatter things and builds as an html file that won't preview with any theme.

local-jekyll-build-theme-trouble.md doesn't have the frontmatter and 'builds' as markdown and 404s when I try to hit it in the browser (unless I add the .md extension in the URL, boo)

It doesn't make any difference if I have committed changes or not. It doesn't matter if I run jekyll via 'bundle exec' or not. I don't get any errors from jekyll (even when using the --trace option)

In Contrast... When I push to GitHub, both pages seem to work properly. I can go to https://breedlovedesign.github.io/ideas/local-jekyll-build-theme-trouble without putting .md in the URL and https://breedlovedesign.github.io/ideas/ serves index.html fine. Both get all the lovely theme CSS as specified in my config.

I had assumed that both files were being converted to html but I double-checked and the _site folder on GitHub also has index.html and local-jekyll-build-theme-trouble.md.

_config.yml

theme: jekyll-theme-minimal

System Info

MacOS 10.15.6

Ruby Version

~/.../devo/ideas on gh-pages*
$ rbenv version
2.6.5 (set by /Users/johnbreedlove/Sync/devo/ideas/.ruby-version)

Gemfile

gem "github-pages", "~> 209"

Jekyll Build Output

~/.../devo/ideas on gh-pages*
$ bundle exec jekyll serve
Configuration file: /Users/johnbreedlove/Sync/devo/ideas/_config.yml
            Source: /Users/johnbreedlove/Sync/devo/ideas
       Destination: /Users/johnbreedlove/Sync/devo/ideas/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 0.616 seconds.
 Auto-regeneration: enabled for '/Users/johnbreedlove/Sync/devo/ideas'
    Server address: http://127.0.0.1:4000
  Server running... press ctrl-c to stop.

Directory Structure

~/.../devo/ideas on gh-pages*
$ tree
.
├── Gemfile
├── Gemfile.lock
├── _config.yml
├── _site
│   ├── assets
│   │   ├── css
│   │   │   └── style.css
│   │   ├── fonts
│   │   │   ├──...
│   │   ├── img
│   │   │   └── logo.png
│   │   └── js
│   │       └── scale.fix.js
│   ├── index.html
│   └── local-jekyll-build-theme-trouble.md
├── index.md
└── local-jekyll-build-theme-trouble.md

10 directories, 30 files

Contents of /index.md

---
---
# icanhaz themes pls?

must I use YAML frontmatter?
1

1 Answers

0
votes

Yes, you must use the YAML front matter. It is made explicit in the jekyll documentation.

Any file that contains a YAML front matter block will be processed by Jekyll as a special file. The front matter must be the first thing in the file and must take the form of valid YAML set between triple-dashed lines.

If you want to use Liquid tags and variables but don’t need anything in your front matter, just leave it empty! The set of triple-dashed lines with nothing in between will still get Jekyll to process your file.

If it works in GitHub Pages, I assume that it does a little preprocessing of its own. But for Jekyll alone, files without front matter are left as they are.