25

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

5
  • That depends on the theme you are using, copy theme files to your site and edit them
    – marcanuy
    Sep 23, 2017 at 3: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? Sep 23, 2017 at 3:47
  • 1
    Yes, that is the only way to modify what it shows.
    – marcanuy
    Sep 23, 2017 at 3: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, 2017 at 3: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. Sep 23, 2017 at 3:51

5 Answers 5

24

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.

0
19

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.

0
3

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

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.