Github Pages Build of Jekyll site is missing pages - jekyll

I'm trying to use Github pages with Jekyll. Most of my pages are displayed as expected, but others (that I can see in the local build) do not show on the Github pages build.
The pages that do work are in the _pages folder with their permalinks set in the front matter. Like this
---
type: page
permalink: /about/
layout: default
---
The pages that don't work are in a folder _projects with similar, but slightly different front matters
---
permalink: /projects/foo
layout: post
---
When I try to access foo.com/projects/foo/ it gives me error 404, but foo.com/about/ works as expected. There are no front matter defaults, so what you see is what is there.

I found my solution in the similar questions as I was writing this, but couldn't with a google search.
Github Pages didn't like having the permalinks for _projects in the format /projects/foo/, but /projects/foo.html works like a charm.

Related

Set a global permalink in Jekyll without the path?

I would like all posts and pages on my Jekyll site to have the same link structure: example.com/my-title, regardless of the directory structure I use to store my files.
Looking at the documentation it seems like I should be able to implement this by putting the following line in my _config.yml:
permalink: /:title.
This almost works. All posts (in the _posts/ directory) get the correct URL. And all pages in my site's home directory also get the correct url. However, pages that are in subdirectories still have the directory path prefixed to the url. For example, if I have a page pages/cats/my-cat.md the URL is example.com/pages/cats/my-cat, instead of what I want (example.com/my-cat). If I set the permalink for that page directly in the front matter as /my-cat I get the desired outcome, but I'd rather not do this on every page.
Is it possible to remove the path from all page URLs?
I see a number of other questions about Jekyll permalinks but nothing that addresses this exactly. This answer from 2013 says that pages will "always remain relative path" but that's fairly old, and also seemed like a throwaway assertion rather than an evidence-backed claim.
You can use Jekyll defaults to apply fallback front matter for files based on a type and/or path. It has the same effect as setting the front matter inside each file. Here's how you could apply that permalink to all pages:
_config.yml:
defaults:
- scope:
path: ''
type: pages
values:
permalink: /:title
It's also a great way to set other common fields, e.g. layout.
Official documentation for further details: https://jekyllrb.com/docs/configuration/front-matter-defaults/

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 (i.e. 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", i.e.
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.

Permalink to External Site with YAML Front Matter

Is it possible to set a permalink to an external site within YAML front matter? I am currently using Jekyll, and I am not finding any information using my Google-Fu.
---
layout: full-width
title: TEST
permalink: https://somethingexternal.example
---
Can permalink break out of it's context and head to somethingexternal? I just want the TEST link to appear on the home page, but when clicked, to go to somethingexternal.example.
[edit]: What happens is that it prepends the webroot to the site, which is the expected behavior. So it ends up like:
mysite.blah/https://somethingexternal...
I just need to break out of it, so that it only goes to the external site. I don't know if permalink can do that, though.
Using permalinks for an external link won't work, permalinks aren't for that.
What you are looking for is to define a custom URL in front matter and then access it's value from the page like this:
---
othersite: http://example.com
---
visit other site

jekyll pages work locally but not when online

I am trying to add a couple links to my jekyll page. Here is the code I added to my _data/links.yml file (Home was there previously, I added the last two):
- url: /
title: Home
- url: /about
title: About
- url: /thoughts
title: Thoughts
It works locally but not when I host my page on github pages. I know jekyll versions are different, I have 2.0.3 locally and I'm not sure what version is on github pages. But this seems like a relatively simple thing. When I click on these links I get a 404 error.
My page is here int-A.github.io and code is hosted here. Is there something that changed in version 2 of Jekyll that would allow this to work but not on an older version (which ever is on github pages)
I believe there is something wrong with permalinks and baseurl="" combination.
Your pages do render at these locations:
http://int-a.github.io/thoughts/thoughts/
http://int-a.github.io/about/about/
I believe the solution would be to set the baseurl as http://int-a.github.io and permalink to /index.html instead of /foldername/index.html

Jekyll 2.0 Issues in Grunt/Yeoman

I've been using Jekyll 2.0 directly from the command line for the last few days. I've put all my page files into a '/pages' folder so it looks like this:
/pages
- index.html
- about.html
- contact.html
In the front matter of each page I set the permalink like this:
permalink: /about/
So when Jekyll compiles the site, I'm able to navigate successfully to localhost:8888/about/ it's been working really well.
The Grunt/Yeoman problem:
I've picked up the generator-jekyllrb for Yeoman today because I want Grunt to manage everything (live reloading etc). I set it up, everything is working fine... but Jekyll is no longer generating the folders according to the permalink.
For example, my "about.html" page inside /pages, is not having an "/about" folder generated in the root like it did when using Jekyll directly. So I can only access the page through: localhost:8888/pages/about/. Which is strange.
Here's my Gruntfile.js generated from Yeoman
I don't know a whole great deal about this stuff. I'm very new to Grunt and the CL, but this has really stumped me. If anyone could offer any advice or point me in the right direction I'd really appreciate it.
I ended up adding the following to my _config.yml:
relative_permalinks: false
which fixed the problem. I think grunt-jekyllrb must be a version behind or something, because absolute permalinks are defaults now in the latest Jekyll.