-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Allow themes to define output formats, media types and params #4490
Comments
We have (or had) a general issue about letting the theme set But I guess:
|
That said; having a Netlify specific |
I think a good way to approach this is to direct users to a repo of a fully formed site (like a demo) that users can clone to start, instead of adding the theme to a fresh install. You can just point to that in your theme's instructions. I don't mean to sound condescending as I imagine you've thought through this: Be super careful with CSPs. They can be a real minefield. One approach may be to set it for "notify only" and have a config setting to switch it to active if it's working in the production site. |
Apologies for the long mess below - lack of sleep makes thinking clearly hard :p
That's what I was thinking. It would also be useful to be able to enable certain output formats, i.e.
I'm not sure if we're talking about the same thing here. I want to avoid having users copy this (or something like it - I haven't tested) into their configuration files:
Users would still have to add Reading your comment, I get the sense that you understood me as saying that themes should be able to add an existing As a user with multiple sites on Netlify, I got annoyed earlier with having to manually modify multiple
I have a full documentation site for my theme, with links to example configuration files. That is the recommended way to set up a site with my theme, but I've learned to not expect users to read the documentation. I also expect that most users will probably use the (Note to self - make a summarized "Quick Start" guide and link to the repo there)
I've been caught in that minefield a couple times already. I'm not sure what you mean regarding "notify only" vs "switch it to active", though. |
@Shadow53 You are right, I thought about |
To prepare for config in themes See gohugoio#4490
To prepare for config in themes See gohugoio#4490
To prepare for config in themes See gohugoio#4490
This allows a `config.toml` (or `yaml`, ´yml`, or `json`) in the theme to set: 1) `params` (but cannot override params in project. Will also get its own "namespace", i.e. `{{ .Site.Params.mytheme.my_param }}` will be the same as `{{ .Site.Params.my_param }}` providing that the main project does not define a param with that key. 2) `menu` -- but cannot redefine/add menus in the project. Must create its own menus with its own identifiers. 3) `languages` -- only `params` and `menu`. Same rules as above. 4) **new** `outputFormats` 5) **new** `mediaTypes` This should help with the "theme portability" issue and people having to copy and paste lots of setting into their projects. Fixes gohugoio#4490
This allows a `config.toml` (or `yaml`, ´yml`, or `json`) in the theme to set: 1) `params` (but cannot override params in project. Will also get its own "namespace", i.e. `{{ .Site.Params.mytheme.my_param }}` will be the same as `{{ .Site.Params.my_param }}` providing that the main project does not define a param with that key. 2) `menu` -- but cannot redefine/add menus in the project. Must create its own menus with its own identifiers. 3) `languages` -- only `params` and `menu`. Same rules as above. 4) **new** `outputFormats` 5) **new** `mediaTypes` This should help with the "theme portability" issue and people having to copy and paste lots of setting into their projects. Fixes gohugoio#4490
This allows a `config.toml` (or `yaml`, ´yml`, or `json`) in the theme to set: 1) `params` (but cannot override params in project. Will also get its own "namespace", i.e. `{{ .Site.Params.mytheme.my_param }}` will be the same as `{{ .Site.Params.my_param }}` providing that the main project does not define a param with that key. 2) `menu` -- but cannot redefine/add menus in the project. Must create its own menus with its own identifiers. 3) `languages` -- only `params` and `menu`. Same rules as above. 4) **new** `outputFormats` 5) **new** `mediaTypes` This should help with the "theme portability" issue and people having to copy and paste lots of setting into their projects. Fixes gohugoio#4490
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I thought I had put in a request for this before, but I can't seem to find it.
I'd like to be able to define my own custom output formats in my theme to make it easier for users to get certain functionality. The main use case I have in mind is to generate a Netlify
_headers
file that gets populated with secure default settings, including a CSP containing only those domains being used for site content, e.g. scripts. I may also use this feature to define a "search index" output format so that I can use the JSON output for something else.The goal here is to make it so users don't have to copy/paste lines of configurations into their config files just to get a theme feature.
The text was updated successfully, but these errors were encountered: