pages-themes / slate

Slate is a Jekyll theme for GitHub Pages
https://pages-themes.github.io/slate/
Creative Commons Zero v1.0 Universal
303 stars 981 forks source link

Extract includes from default.html #6

Closed adamvoss closed 7 years ago

adamvoss commented 7 years ago

This extracts parts of default.html into includes along the same structure as minima. I contribute to a project that uses GitHub pages and this theme, and now it to add more content than a single page. This was done as a first step towards adding support in the theme for more layout types.

Aside from white space differences and moving the Googe Analytics to a more traditional place in head this makes a point not to change the generated output.

benbalter commented 7 years ago

@vossad01 Thanks for the pull request. I'd love to learn more about what problems you're trying to solve here. Specifically, two questions:

  1. What's the value of moving the GA tracking code to an include?
  2. What's the value of breaking the header and footer into includes?

Because Slate is available in the theme chooser we need to balance those goals against the added complexity of a site intended to be a starting point for novice users.

adamvoss commented 7 years ago

Thanks for taking a look. Slate only provides a default layout which becomes restrictive when a site wants to grow beyond a single page. This is the problem I will hope to address. I really wasn't sure how this would fit with this project's philosophy since right now it appears the only theme available on GitHub Pages that provides more than one layout is minima.

Instead of making the design decisions myself, it seemed more consistent, and thus simpler for users, to follow the same conventions as minima (since it is the default Jekyll theme). I have made an effort below to rationalize them below, but the fact that it was how minima did it was the primary guide.

What's the value of moving the GA tracking code to an include?

This provides for a more consistent level of abstraction in head.html. Readers can easily understand there is google analytics code provided by the include, without needing to see the inline script and minified code.

What's the value of breaking the header and footer into includes?

I anticipate that the header takes more vertical space than will be desired on some page types, thus it may be desirable to have a layout that includes the footer, but includes a different header.

Applicable to both questions is that includes allow for customization of aspects of a theme without requiring a user to become responsible for maintenance and update of all aspects of the theme. Thus a custom head.html implementation could still reference the google-analytics.html include provided by the theme and receive any updates or changes to that code.

adamvoss commented 7 years ago

I wasn't sure if I would ultimately get any traction with this, so I went a different direction: https://github.com/vossad01/jekyll-minima-flavor-slate