Github does not render my site correctly

I have a Jekyll site that I’ve uploaded to github. Everything works perfectly, except:

The menu-bar on github is picking up heading fields from the individual pages, and the heading is duplicated on the pages when they are rendered.

This is the site

And this is how it looks on the local server

Can someone please help me fix it?

Aha. Jekyll is picking up the page title from the first heading on each page and using that to build the menu

So remove “WxPython from Scratch” from each page. Then will use the heading after it which seems to be more appropriate.

Even better is move data to frontmatter to make it easier to manage. So take out any h2 / ## etc tags from your pages and rather put the metadata at the top as

title: My title
layout: page

Page content 

And then create or update a layout file such that the heading appears on the page inside an h2 tag or similar

Also I see you have a bunch of files with post in the name. There is jekyll feature where you put posts in a posts folder (with a specific name format including the date) and then you can separate pages like About and Contact from posts which can appear as a list of blog posts on the Blog page or homepage as well as individual post pages. This means you have a super long nav bar.

You can add topics or categories to posts too to make them easy to group and find.

Thanks . I think

title: ""

sorted it

Mmmmm doesn’t explain while github gives a different result from local server

OK good.

Perhaps you have a Jekyll version later than Github’s 3.8.5 causing the difference?

I’m only going to throw out something here.

I don’t know how complex you want to make your Jekyll site, however you are going to find github pages unfortunately has a lot of limitations particularly if installing some different packages. I’m no expert in the matter but its really super annoying to the end user.

I still use Git to store all my files, but I switched from github pages to netlify to build and host the site. For me the change was fairly easy and things tended to render a lot better such as they do on the localhost as compared to github pages.

This is so far off topic I know, since I doubt your current problem has anything to do specifically with github pages.

I’m using v 4.0.0 Can I downgrade?

You you can downgrade. In your Gemfile you probably have a line like:

gem "jekyll", "~> 4.0.0"

Just make it:

gem "jekyll", "~> 3.8.5"

And then run

bundle update
1 Like

Thanks. Done it! Yet to test on github though

Hi, my site is being rendered without CSS. Possible to know why is this happening?

Well I’ve solved my problem. It all comes down to includes and I had to learn quite a lot about Jekyll before I got to it

In -includes/header.html the following code appears

        {%- if my_page.title -%}
        {%- endif -%}

I simply removed the offending line printing the title which was causing all of the problems.

As my site is just static pages, I’m probably going to change to Sphinx/Netlify now as kevdog suggests. Already got some pages up and running successfully and, I think it’s simpler.

The Jekyll experience has been valuable as I’ve learned a lot, but I’m not sure it’s for me