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

theme namespace #35

Open
hatakawas opened this issue Oct 13, 2019 · 4 comments
Open

theme namespace #35

hatakawas opened this issue Oct 13, 2019 · 4 comments

Comments

@hatakawas
Copy link

hatakawas commented Oct 13, 2019

I have a theme with a little long name, like jekyll-theme-xxxx-xxx. The theme have some config variables, like

theme: jekyll-theme-xxxx-xxx

xxxx:
  someKey: someValue

I use the variables as site.xxxx.someKey in my templates. However i find it a little boring to refer them.

I noticed that you registered a default namespace for theme: [theme-name], which is awesome!!!

However, if i want to refer to my variables as theme.someKey, i have to change the namespace xxxx to jekyll-theme-xxxx-xx which is the theme name. But i still want to refer some variables directly, I have to do it like site.jekyll-theme-xxxx-xxx.anotherKey instead of site.xxxx.anotherKey.

What i mean, is it possible to give me a chance to specify a short theme namespace key, as a primary choice? Like:

theme: jekyll-theme-xxxx-xx

theme_namespace: xxxx

xxxx:
  someKey: someValue
  anotherKey: anotherValue

By this way, i can use theme.someKey or directly site.xxxx.anotherKey in templates then.

Thank you!

@ashmaroli
Copy link
Owner

Thank you for requesting this feature.
I had plans to introduce it myself some time ago, but I dropped it because no one seemed to be interested in having this feature (or the theme namespace as such..)

I think theme_namespace is a reasonable choice..

I shall first open a PR to have this entire feature-set included in Jekyll itself. If it gets accepted there, then awesome. Otherwise, i'll ship the enhancement as part of this plugin..

@hatakawas
Copy link
Author

Thank you for the reply. Please let me know the result then, thanks~

@hatakawas
Copy link
Author

hatakawas commented Oct 13, 2019

By the way, i think u can also add this feature here as a temporary resolution, for older version of jekyll even if the jekyll official accepted your PR.
Actually, i need your data plugin, also this feature ^_^

@ashmaroli
Copy link
Owner

Just leaving a note here that I've not forgotten about this.
I'm currently facing complications regarding theme_namespace configuration in a _config.yml from the theme-gem and being overridden at user's source and having it all play nicely together..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants