Search code examples
githubjekyllgithub-pagesjekyll-theme

How do I customize Jekyll theme for a single page in GitHub pages?


I want to remove the large hero header for a particular page inside my GitHub pages site.

I know how to customize the themes layout, however I only want to customize the layout for a particular page.

Ex:

  • README.md: the "home page" aka /. I do NOT want to customize
  • credits.md: the credits page at /credits. I do NOT want to customize.
  • help.md: the help page at /help. I DO want to customize. I want to remove the header.

I'd like to do something like /assets/css/help-style.scss

---
---

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

header {
  display: none;
}

Solution

  • The easiest way would be to just define a new layout for your help.md

    1. Create a copy of the layout currently used by help.md (say, page.html)
    2. Rename the new layout as help.html (path: _layouts/help.html)
    3. Remove markup that renders the large hero header
    4. Use layout: help in the front matter of help.md:

      ---
      layout: help
      ---