benbalter / jekyll-remote-theme

Jekyll plugin for building Jekyll sites with any GitHub-hosted theme
MIT License
288 stars 76 forks source link

Feature: Include _data from theme in sites that use the theme #68

Closed hblankenship closed 4 years ago

hblankenship commented 4 years ago

Not being able to have the _data/ collections in a remote theme be accessible to sites that use the theme is problematic.

There are useful collections that one might consider putting in a remote theme and using across many repositories (the owasp foundation website https://owasp.org is a collection of repositories making up one website). Such data might include a default menu system for all sites that resides in the header or a default set of corporate supporters to display in a footer.

I propose that any collection that exists in a _data folder in the remote theme be accessible via sites that use the theme. Further, in case of name collisions, if the site implementing the remote theme uses a data collection of the same name then the remote theme's version of the collection is replaced by the site's version. This functionality is available in a ruby gem for gem themes and would be useful here.

Currently the alternative to this is to put data in a separate folder in a json file and load the json file via javascript in the remote theme. This workaround assumes the use of javascript and we would like to avoid requiring js.

delisma commented 4 years ago

This feature could be useful for i18n and/or l10n, when building multilingual theme and the 118n strings sits in _data folder. In case of conflicts the files in _data can always be overridden like the _includes and _laytouts folders are.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

mgerzabek commented 3 years ago

In these days we have hundreds of tracking services, marketing automation services, form frameworks, etc. that all require a couple of paragraphs in a GDPR statement. It’s the obligation of a consumer project to gather these semi-legal pieces of information and to put them into a privacy statement.

Instead of putting these text modules into a privacy page itself I propose to put them into a catalogue in the data folder of a theme.

This way a kind of micro MVC pattern could be implemented by offering a specialized layout in combination with a page that extends this layout. The data file would become the model, the layout the view and the page on the consumer project the controller.

As @benbalter tagged this issue to be a good first issue I implemented the additions to his plugin in #89 and an implementation of the pattern in my first remote theme https://github.com/storyfaktor/klartext.

model: _data/datenschutz.json view: _layouts/datenschutz.html

controller: Any page which utilizes the layout from the remote_theme. In the frontmatter boolean switches control which text modules get included in rendering.

Reviews welcomed.

GitHub
storyfaktor/klartext
Ein Jekyll Theme für EPUs, Brainworker (Berater, Trainer und Coaches), Content Marketer, Autoren, Wissenschafter und Schreibwütige. - storyfaktor/klartext