You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

creating-a-theme.md 2.7KB

6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. +++
  2. title = "Creating a theme"
  3. weight = 30
  4. +++
  5. Creating is exactly like creating a normal site with Gutenberg, except you
  6. will want to use many [Tera blocks](https://tera.netlify.com/docs/templates/#inheritance) to
  7. allow users to easily modify it.
  8. ## Getting started
  9. As mentioned, a theme is just like any site: start with running `gutenberg init MY_THEME_NAME`.
  10. The only thing needed to turn that site into a theme is to add `theme.toml` configuration file with the
  11. following fields:
  12. ```toml
  13. name = "my theme name"
  14. description = "A classic blog theme"
  15. license = "MIT"
  16. homepage = "https://github.com/Keats/gutenberg-hyde"
  17. # The minimum version of Gutenberg required
  18. min_version = "0.3"
  19. # Any variable there can be overriden in the end user `config.toml`
  20. # You don't need to prefix variables by the theme name but as this will
  21. # be merged with user data, some kind of prefix or nesting is preferable
  22. # Use snake_casing to be consistent with the rest of Gutenberg
  23. [extra]
  24. # The theme author info: you!
  25. [author]
  26. name = "Vincent Prouillet"
  27. homepage = "https://vincent.is"
  28. # If this is porting a theme from another static site engine, provide
  29. # the info of the original author here
  30. [original]
  31. author = "mdo"
  32. homepage = "http://markdotto.com/"
  33. repo = "https://www.github.com/mdo/hyde"
  34. ```
  35. A simple theme you can use as example is [Hyde](https://github.com/Keats/hyde).
  36. ## Working on a theme
  37. As a theme is just a site, you can simply use `gutenberg serve` and make changes to your
  38. theme, with live reloading working as expected.
  39. Make sure to commit every directory (including `content`) in order for other people
  40. to be able to build the theme from your repository.
  41. ### Caveat
  42. Please note that [include paths](https://tera.netlify.com/docs/templates/#include) can only be used in normal templates.
  43. Theme templates should use [macros](https://tera.netlify.com/docs/templates/#macros) instead.
  44. ## Submitting a theme to the gallery
  45. If you want your theme to be featured in the [themes](./themes/_index.md) section
  46. of this site, the theme will require two more things:
  47. - `screenshot.png`: a screenshot of the theme in action with a max size of around 2000x1000
  48. - `README.md`: a thorough README explaining how to use the theme and any other information
  49. of importance
  50. The first step is to make sure the theme is fulfilling those three requirements:
  51. - have a `screenshot.png` of the theme in action with a max size of around 2000x1000
  52. - have a thorough `README.md` explaining how to use the theme and any other information
  53. of importance
  54. - be of reasonably high quality
  55. When your theme is ready, you can submit it to the [themes repository](https://github.com/Keats/gutenberg-themes)
  56. by following the process in the README.