26

I am trying GitHub Pages for my developer blog post, unfortunately I am having a hard time deleting the header part after choosing a theme.

Even though I already edited the Readme.md, the header is still there and I can't even remove or edit it. Do you have any idea on how to remove or edit it? There are only 2 files on my repositories: Readme.md and _config.yml

enter image description here

Willy David Jr
  • 8,604
  • 6
  • 46
  • 57
  • That depends on the theme you are using, copy theme files to your site and edit them – marcanuy Sep 23 '17 at 03:45
  • I just choose a theme under settings of repository. There are only 2 files on repositories. Do I need to download the whole theme then commit it to my repo? – Willy David Jr Sep 23 '17 at 03:47
  • 1
    Yes, that is the only way to modify what it shows. – marcanuy Sep 23 '17 at 03:48
  • I forgot to say, you don't need to commit all the theme files, you can just copy the file you modify – marcanuy Sep 23 '17 at 03:49
  • I see, I really don't know how it will work since there is no file on repositories where I can see the layout and other related stuffs and update it, but I will try. – Willy David Jr Sep 23 '17 at 03:51

5 Answers5

22

I found you can customize your site CSS to hide the header by creating the file:

/assets/css/style.scss

---
---

@import "{{ site.theme }}";

header {
  display: none;
}

This is a closed issue on Github.


That said, you may want to override the HTML layout, so your site doesn't unexpectedly break.

Carl Walsh
  • 6,100
  • 2
  • 46
  • 50
18

I encountered the same issue with the default Jekyll theme (primer). I found this closed issue very helpful.

My steps to resolve with the default GitHub pages theme, based on the post linked above:

  1. Add _config.yml in the root of the GitHub Pages repo
  2. Add the following lines to _config.yml:
name: luaphacim's site
title: null

Another workaround for this theme would be to give your page the same title as the title you specify in _config.yml.

luaphacim
  • 348
  • 2
  • 8
2

First, to customize the Jekyll SEO Tag, you can set the name of the site as an empty string and nullify the title itself, so that it does not appear to the right of the title of each page — create this file in the root of your repository:

_config.yml

name: ""
title: null

Then, to completely remove the header block from your page, you can override the default layout. Copy the original file default.html to the _layouts folder of your repository and remove this block:

<header>
  <!-- TL;DR -->
</header>

By default GitHub uses the Primer theme — it can also be customized in the same way as other themes.


See also: Editing the footer in GitHub pages jekyll's default minima theme

0

Best approach to me is to get the templates for the layout you have chosen, add these to your repository, and update them to remove the header. Worked for me.

0

You can resolve this by the following steps.

  1. Clone / download the pages-themes/hacker repository.

  2. Copy the assets folder into your repository.

  3. Open the style.scss file located under /assets/css/style.scss folder.

  4. Add the following code into the file.

    @import "{{ site.theme }}";
    
    header {
        display: none;
    }
    

enter image description here

Codemaker2015
  • 12,190
  • 6
  • 97
  • 81