Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC Reusable themes #301

Open
epage opened this issue Oct 20, 2017 · 6 comments
Open

RFC Reusable themes #301

epage opened this issue Oct 20, 2017 · 6 comments
Labels
enhancement Improve the expected question Uncertainty is involved
Milestone

Comments

@epage
Copy link
Member

epage commented Oct 20, 2017

Cobalt supports

The problem is this doesn't allow easily redistributed themes

  • Files are spread out, making it hard to share / reuse
  • Non-theme snippets are mixed in with theme
  • Theme assets are mixed in with content

Proposal

  • Add _theme/<name> that contains
    • _theme.yml for theme metadata
      • theme asset permalink
      • syntax highlight theme (overrides the global syntax highlight theme)
      • custom fields (on a theme.custom variable)
    • _layouts files for page wrappers
    • _includes directory that is available from theme/ include path
    • _data directory that is available from site.theme.*
    • _sass directory for importable sass documents
    • Everything else will be treated as an asset and copied over according to the permalink (default is theme/slug.ext)
  • Keep layouts folder for low-overhead themes
    • Process layouts if theme is not present
  • _cobalt.yml configuration of themes
    • global theme: <slug> for setting the default for every collection
    • Per-collection theme: <slug>
    • Override mechanism: theme: <slug> is actually short-hand for theme: { "name": <slug>, "syntax-theme": <theme>, "data": <data>}

Prior Art

Jekyll

See https://jekyllrb.com/docs/themes/

Hugo

See https://gohugo.io/themes

  • _layouts overrides theme
  • themes can contribute to hugo new, see archtypes
@epage
Copy link
Member Author

epage commented Nov 15, 2017

Do we expect our users to have a single theme for their entire site?

If they will have multiple themes, would it be per collection (pages, posts etc)? And/or will they want multiple themes within one collection particularly pages.

Design impact: Either we have

  • a single theme auto-loaded if the _theme folder exists
  • multiple themes that are specified per collection (pages, posts, etc) or in the frontmatter

@epage
Copy link
Member Author

epage commented Dec 30, 2017

#328 took care of the breaking changes in this.

@Geobert
Copy link
Contributor

Geobert commented Jan 1, 2018

What about some overloading mechanism? A global theme, and possibility to override per collection and/or per page?

@Geobert
Copy link
Contributor

Geobert commented Jan 1, 2018

And we should support Jekyll's theme out of the box, so we'll get the existing huge repository. Gutenberg has so many themes thanks to Hugo's.

EDIT: or enhance the Jekyll conversion to convert themes as well

@epage
Copy link
Member Author

epage commented Jan 1, 2018

A global theme, and possibility to override per collection and/or per page?

Yes, we should support a global theme and allow it to be overridden per-collection. I'd like to avoid per-page unless there is a strong use case for it. This means the directory hierarchy would be _theme/<name>/<data>.

And we should support Jekyll's theme out of the box, so we'll get the existing huge repository. Gutenberg has so many themes thanks to Hugo's.

EDIT: or enhance the Jekyll conversion to convert themes as well

The challenge is in the differences between us on Jekyll. I agree about the conversion utility supporting themes.

@Geobert Geobert mentioned this issue Jan 2, 2018
@epage epage added this to the 1.0 milestone Jan 7, 2018
@epage epage modified the milestones: 1.0, 0.13 Jan 22, 2018
@epage epage changed the title Reusable themes RFC Reusable themes Mar 19, 2018
@epage epage added the question Uncertainty is involved label Mar 19, 2018
@berkus
Copy link

berkus commented Apr 22, 2018

see archtypes

archetypes, and these are immensely useful in any non-trivial static site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve the expected question Uncertainty is involved
Projects
None yet
Development

No branches or pull requests

3 participants