jekyll-data icon indicating copy to clipboard operation
jekyll-data copied to clipboard

theme namespace

Open hatakawas opened this issue 5 years ago • 4 comments

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!

hatakawas avatar Oct 13 '19 05:10 hatakawas

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..

ashmaroli avatar Oct 13 '19 05:10 ashmaroli

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

hatakawas avatar Oct 13 '19 06:10 hatakawas

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 ^_^

hatakawas avatar Oct 13 '19 06:10 hatakawas

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..

ashmaroli avatar Oct 18 '19 06:10 ashmaroli