peterdesmet / petridish

Jekyll theme for research project websites 🧫
https://peterdesmet.github.io/petridish
MIT License
53 stars 44 forks source link

Internationalized examples? #79

Closed dshorthouse closed 1 year ago

dshorthouse commented 1 year ago

Any examples or suggestions for how one might make use of this theme for a site that aspires to serve content (= navigation and pages) in multiple languages? Preferably, the URL paths should also be internationalized, though not a show-stopper.

peterdesmet commented 1 year ago

There is no elegant support or plugin out of the box, mainly because GitHub Pages restricts what Jekyll plugins can be used. But, luck would have it that I set up a multiple language site last month at https://github.com/inbo/vespa-watch/tree/gh-pages

What I did:

  1. Organize (Markdown) pages in language directories (fr content is only kept for archival reasons)
  2. Create a navigation and footer for each language
  3. Set frontmatter defaults to:
  4. Create custom navbar.html include which will overwrite Petridish one. It:
  5. Create custom footer.html include which will overwrite Petridish one. The only change is that it includes code to select the correct footer.yml, rather than the default _data/footer.yml one.

You can see the result at https://vespawatch.be/

peterdesmet commented 1 year ago

Note: URL paths can be internationalized with this approach, since the permalink picks up the name of the Markdown file:

permalink: /en/:basename/

I opted to name give the Markdown files the same names in Dutch and English (pages/nl/get-involved.md and pages/en/get-involved.md), so it's easier to understand what are the corresponding pages for each language. You can opt to give them different names or to set a custom permalink in the frontmatter for each page like this:

https://github.com/peterdesmet/petridish/blob/8f20d8b28498df630edc085c1a1251bafc4da7da/pages/docs/configuration.md?plain=1#L8

dshorthouse commented 1 year ago

Me & colleagues had been playing the "minimal mistakes" theme, but had been sucked into a blackhole. Restrictions on plugins is a v. useful piece of advice. And, thanks very much for this recipe. You may soon have another example that uses your gem :)~

peterdesmet commented 1 year ago

The limited or overly complicated customization of most existing Jekyll themes is why I started Petridish.

If you were literally referring to a (Ruby) gem, note that I haven't implemented gem-based installation (#25 ). See http://peterdesmet.com/petridish/docs/installation/ for recommended installation.

If you were figuratively referring to gem, carry on. 😄

dshorthouse commented 1 year ago

If you were literally referring to a (Ruby) gem, note that I haven't implemented gem-based installation (#25 ). See http://peterdesmet.com/petridish/docs/installation/ for recommended installation.

Ah! In that case, "You may soon have another example that uses your nutrient agar."