sandoche / Jekyll-webpack-boilerplate

⚡️ A boilerplate with Jekyll and Webpack to make the most performant static websites
MIT License
188 stars 57 forks source link

how to use _data folder? #4

Closed me0wday closed 6 years ago

me0wday commented 6 years ago

Hello, this is great and I am attempting to start a website with it, my only concern is how can I use the standard jekyll _data folder for common variables?

I attempted to remove the language plugin but got a bit lost after this as it wasn't reading the data folder so I was left without the yml files.

sandoche commented 6 years ago

Hello, Thanks,

It is totally doable to use the _data folder.

Two alternative solutions:

The first solution is the fastest.

To delete the i18n plugin here is the process:

  1. Delete gem 'jekyll-multiple-languages-plugin' from Gemfile.
  2. Delete - jekyll-multiple-languages-plugin from _config.
  3. Delete the _i18n folder.
  4. Remove all the liquid function like this one {% t variable_name %} from the _include and _layout folders (so footer.html, 'home.html', and maybe some others)
  5. Delete about.md
  6. Then run npm start and check the logs it will tell you if the {% t variable_name %} tag is still somewhere else
me0wday commented 6 years ago

I tried solution 1, however none of my site.data variables are being read when placing yml files in the _data folder?

(I did also do Solution 2, which was fine to remove the plugin, however I ran into this issue because I needed to use data variables instead)

me0wday commented 6 years ago

Tried again with a fresh pull, followed the process and added the _data folder, but variables aren't being read.

sandoche commented 6 years ago

In the layout home.html

{{ site.data.strings.header.title }}

me0wday commented 6 years ago

Thanks mate, not sure what was happening but it's working now :) appreciate the help.

me0wday commented 6 years ago

Is there any way that I could contact you privately? Just after some tips if you have the time.

sandoche commented 6 years ago

You're welcome. I just created a telegram group: https://t.me/JekyllWebpack