简体   繁体   中英

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;
}

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 --- 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM