-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Theme related suggestions #1229
Comments
Some of these are good ideas and would definitely make things a little cleaner. As i'm already actually working on a new default theme, i'll see what I can do about adding some of these improvements. The one thing that is not relaly possible, is the |
Grav looks good, I'm glad to provide some feedback. About |
Quite a few improvements have been taken care of here: #1232 |
This PR has been merged, just need to document it all! |
Hi, I have some suggestions related to Base Template, theme tutorial and variables, from the theme developer's perspective.
{% set theme_config = attribute(config.themes, config.system.pages.theme) %}
That's not great to be required to define a basic variable by default in a template. I found it's already available in grav as
config.theme
so maybe we can delete this from Base Template and docs.<html lang="{{ grav.language.getActive ?: theme_config.default_lang }}">
-><html lang="{{ page.language ?: site.language }}">
There's already
page.language
available, just introduce default variablesite.language
and it gets a lot cleaner.theme_config.default_lang
is not the best because it should be default site language as set by the user and not theme language as set by theme developer.default_lang
is also not even defined in the theme config of Base Template.<title>{% if header.title %}{{ header.title|e('html') }} | {% endif %}{{ site.title|e('html') }}</title>
-><title>{% if page.title %}{{ page.title|e }} | {% endif %}{{ site.title|e }}</title>
page.title
is more intuitive and doesn't introduce new top-level variable, 'html' is default for escape filter<link rel="canonical" href="{{ page.url(true, true) }}" />
Maybe consider introducing some new variable like
page.permalink
but for canonical, e.g.page.canonical
{{ page.header.body_classes }}
- >{{ page.body_classes }}
{{ base_url == '' ? '/' : base_url }}
Can't
base_url
just return '/' instead of ''? Also I had to check where it came from as it's a new top-level variable. Something likesite.url
would be more intuitive.{{ config.site.title }}
->{{ site.title }}
Generally speaking I'd make most of variables available as
x.y
and notx.y.z
, while also limiting the number of top-levelx
variables available.config.system.variable
->system.variable
config.theme.variable
->theme.variable
config.site.variable
->site.variable
page.header.variable
->page.variable
header.variable
->page.variable
I think these changes would make Base Template, documentation, and workflow with grav more clean and intuitive. Some of them are already supperted but not documented as default worflow.
The text was updated successfully, but these errors were encountered: