diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 0000000..4d3adb2 --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,33 @@ +name: lint + +on: + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + prettier: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Set up node + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: npm install + + - name: Prettify code + run: npx prettier . --check diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000..31354ec --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..36af219 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/.prettierrc b/.prettierrc index 9e74d98..0e65ca8 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,13 @@ { + "plugins": ["@shopify/prettier-plugin-liquid"], "singleQuote": true, + "overrides": [ + { + "files": "*.html", + "options": { + "parser": "liquid-html", + "singleQuote": false + } + } + ] } diff --git a/Gemfile b/Gemfile index e502da7..6dab89d 100644 --- a/Gemfile +++ b/Gemfile @@ -34,4 +34,4 @@ end gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem "webrick", "~> 1.7" -gem 'jekyll-sass-converter', '~> 2.1.0' \ No newline at end of file +gem 'jekyll-sass-converter', '~> 2.1.0' diff --git a/README.md b/README.md index 2f55483..585809c 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,40 @@ # TWC The Netherlands -This repository is responsible for most content visible on the website [techwerkers.nl](https://techwerkers.nl). The site is made with a static site generator called [Jekyll](https://jekyllrb.com/) in a language called Ruby. +[![Netlify Status][netlify_bagde]][netlify_url] +[![Code style][code_style_badge]][code_style_url] +[![Twitter: nederlandtwc][twitter_badge]][twitter_url] -## Getting Started +[![website][website_badge]][website_url] +[![production][production_badge]][production_url] +[![i18n-en][i18n_en_badge]][i18n_en_url] +[![i18n-nl][i18n_nl_badge]][i18n_nl_url] -### With Docker (recommended) +> This repository is responsible for most content visible on the website [techwerkers.nl](https://techwerkers.nl). The site is made with a static site generator called [Jekyll](https://jekyllrb.com/) in a language called Ruby. -We use Docker to have a reproducible development environment. -Before proceeding, install [Docker Compose](https://docs.docker.com/compose/install/) on your system. +## πŸ› οΈ Installation -1. Start the application with the command: `docker-compose up` -2. Access the application in a browser at `localhost:4000` -3. Execute other commands in the Docker container: `docker-compose run --rm --service-ports jekyll bash` +Read the [installation guide](./docs/contributing.md) to get set up. -### Without Docker +## 🀝 Contributing -1. Install dependencies: `bundle install` -2. Start a local server: `bundle exec jekyll serve` -3. Verify all internal links are valid: `bundle exec rake` -4. (Optional) to reproduce Netlify functions run `npx decap-server`; then you can access `/admin` or other Netlify services +Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/techworkersco/twc-site-nl/issues). You can also take a look at the [contributing guide](./docs/contributing.md). -Open a browser to localhost:4000 + -## Add an event +[code_style_badge]: https://img.shields.io/badge/code%20style-prettier-F7B93E?logo=Prettier +[code_style_url]: /.prettierrc +[netlify_bagde]: https://api.netlify.com/api/v1/badges/05f9fda5-6fd8-418d-9cee-67882c0f5dba/deploy-status +[netlify_url]: https://app.netlify.com/sites/twc-site-nl/deploys +[website_badge]: https://img.shields.io/badge/website-url-blue.svg +[website_url]: https://techwerkers.nl/ +[production_badge]: https://img.shields.io/badge/production-url-blue.svg +[production_url]: https://app.netlify.com/sites/twc-site-nl/deploys +[twitter_badge]: https://img.shields.io/twitter/follow/nederlandtwc.svg?style=social +[twitter_url]: https://twitter.com/nederlandtwc -Add a file inside the [`_events`](_events) directory. Copy a previous file as a template, and make sure to include the right time zone for The Netherlands! + -## Add a blog post (inside /blog) - -Add a file inside the [`_blog`](_blog) directory. Copy a previous file as a template. If an author does not exist, add one inside [`_data/authors.yml`](_data/authors.yml). A name is the only thing necessary, but photo is optional too. - -## Add a press mention - -Inside [`_data/press.yml`](_data/press.yml) file, add a media entry, with date format in `YYYY-MM-DD`. - -## Translation - -I18n (internationalization) is made available with the [jekyll-multiple-languages-plugin](https://github.com/kurtsson/jekyll-multiple-languages-plugin/). When a page has a translated version available, a link will show up on the top right if you use the [default_translate](_layouts/default_translate.html) layout. English is the default language, while other languages have their two letter ISO code prefixed, for example [TechWorkersCoalition.org/ru](https://TechWorkersCoalition.org/ru) for Russian. - -### Localise date -Normally displaying a date is done using native liquid templates `{{ page.date | date: '%-d %B %Y' }}`, but for localisation, we need to pass it a language which can be done using our custom [_plugins/i18n_filter.rb](_plugins/i18n_filter.rb), and translation keys. We would replace our liquid template with the following: - -`{{ page.date | localize: site.lang, '%-d %B %Y' }}` - -### Adding new language -1. Add new language key to [en.yml](_i18n/en.yml) -2. Add two letter iso code in [config](_config.yml). The order here determines the order shown on the page. English must be first. -3. Inside the [i18n](_i18n) directory create a - - `LANGUAGE.yml` with the language key and value in its own language, for example `es: EspaΓ±ol` - -Note, only the default [en.yml](_i18n/en.yml) must contain the names of each language. The other language yaml files contain just their own language key. To include only certain languages, specify the exact language keys you want. For example `languages: ["en", 'ja']` - - -### API feeds - -Currently [techworkerscoalition.org](https://techworkerscoalition.org) uses Berlin press and events either from GitHub or directly from our exposed APIs e.g [/events.json](https://techwerkers.nl/events.json). You can find other uses cases [here](https://github.com/techworkersco/twc-site/blob/master/_config.yml#L32) - - -### Supported Pages -* Landing Page [index.yml](index.md) -* Join Page [join.md](join.md) -* Events [events.md](events.md) -* Press mentions [press_mentions.md](press_mentions.md) - -### Supported Languages -* English -* Nederlands \ No newline at end of file +[i18n_en_badge]: https://img.shields.io/badge/i18n-en-orange.svg +[i18n_en_url]: ./_i18n/en.yml +[i18n_nl_badge]: https://img.shields.io/badge/i18n-nl-orange.svg +[i18n_nl_url]: ./_i18n/nl.yml diff --git a/_config.yml b/_config.yml index 6fec99c..08bb1cd 100644 --- a/_config.yml +++ b/_config.yml @@ -16,12 +16,9 @@ title: Tech Werkers NL email: contact@techwerkers.nl description: Tech Workers Coalition Netherlands is where tech workers come together to build collective power in our workplaces. -url: "https://techwerkers.nl" -baseurl: "" -timezone: "Europe/Amsterdam" - -sass: - style: compressed +url: 'https://techwerkers.nl' +baseurl: '' +timezone: 'Europe/Amsterdam' # Build settings feed: @@ -52,10 +49,13 @@ social: sass: style: compressed + +include: + - _pages exclude: - .jekyll-cache/ -languages: ["en", "nl"] -exclude_from_localizations: ["assets", "admin", "vendor"] +languages: ['en', 'nl'] +exclude_from_localizations: ['assets', 'admin', 'vendor'] header_themes: - url: /about text: about @@ -70,19 +70,22 @@ collections: events: output: true permalink: events/:title + pages: + output: true + permalink: /:path defaults: - scope: - path: "" + path: '' values: image: /assets/img/beat_the_boss.jpg - scope: - type: "events" - path: "" + type: 'events' + path: '' values: - layout: "event" + layout: 'event' - scope: - type: "blog" - path: "" + type: 'blog' + path: '' values: - layout: "blog" + layout: 'blog' diff --git a/_events/mozfest-house-amsterdam.md b/_events/mozfest-house-amsterdam.md index d61094b..fd165e3 100644 --- a/_events/mozfest-house-amsterdam.md +++ b/_events/mozfest-house-amsterdam.md @@ -1,9 +1,10 @@ --- -title: "MozFest House: Amsterdam" +title: 'MozFest House: Amsterdam' date: 2024-06-12 09:00 locations: - Online hide_form: false -image: "" +image: '' --- + Find our table stand for some Zines and to meet tech workers! diff --git a/_i18n/en.yml b/_i18n/en.yml index 1df2c83..3e168d1 100644 --- a/_i18n/en.yml +++ b/_i18n/en.yml @@ -22,9 +22,8 @@ home: more: Find more blog posts other_chapters: title: Other chapters - more: | + more: |

Find other chapters of Tech Workers Coalition this overview.

- connect: info: Get involved! @@ -55,10 +54,10 @@ press: en: time: formats: - default: "%A, %d %b %Y %H:%M" + default: '%A, %d %b %Y %H:%M' date: formats: - default: "%-d %B %Y" + default: '%-d %B %Y' order: - :day - :month @@ -84,7 +83,7 @@ en: - Sept - Oct - Nov - - Dec + - Dec day_names: - Sunday - Monday @@ -106,4 +105,4 @@ en: - September - October - November - - December + - December diff --git a/_i18n/nl.yml b/_i18n/nl.yml index 69bb2b2..3494bf9 100644 --- a/_i18n/nl.yml +++ b/_i18n/nl.yml @@ -22,7 +22,7 @@ home: more: Alle blogs other_chapters: title: Andere groepen - more: | + more: |

Ontdek andere groepen binnen de Techwerkerscoalitie in dit overzicht.

connect: @@ -33,7 +33,7 @@ connect: public_link: Sociale media link public_link_placeholder: LinkedIn, Xitter, Mastodon, etc. company: Werkgever - how_did_hear: Wat zou jou helpen je doelen te bereiken? + how_did_hear: Wat zou jou helpen je doelen te bereiken? subscribe: Doe mee global: @@ -53,12 +53,12 @@ press: nl: time: formats: - default: "%A, %-d %B %Y %H:%M" - long: "%-d %B %Y %H:%M" - short: "%d %b %H:%M" + default: '%A, %-d %B %Y %H:%M' + long: '%-d %B %Y %H:%M' + short: '%d %b %H:%M' date: formats: - default: "%-d %B %Y" + default: '%-d %B %Y' order: - :day - :month diff --git a/_includes/blog.html b/_includes/blog.html index 1504056..c4089b2 100644 --- a/_includes/blog.html +++ b/_includes/blog.html @@ -1,4 +1,4 @@ -{% unless page.permalink == "/blog" %} +{% unless page.permalink == '/blog' %} {% t home.blog.more %} {% endunless %} diff --git a/_includes/event-card.html b/_includes/event-card.html index c2a3987..cc9bc7e 100644 --- a/_includes/event-card.html +++ b/_includes/event-card.html @@ -1,36 +1,37 @@
  • - - {{ event.date | date: "%d" }} + + + {{ event.date | date: "%d" }} +
    - - {% if include.limit %} -

    - {{ event.title }} -

    - {% else %} -

    - {{ event.title }} -

    - {% endif %} + + {% if include.limit %} +

    + {{ event.title }} +

    + {% else %} +

    + {{ event.title }} +

    + {% endif %}
    -
  • \ No newline at end of file + diff --git a/_includes/events.html b/_includes/events.html index 024284e..e65ab26 100644 --- a/_includes/events.html +++ b/_includes/events.html @@ -1,4 +1,4 @@ -{% unless page.permalink == "/events" %} +{% unless page.permalink == '/events' %} {% t home.events.more %} {% endunless %} diff --git a/_includes/head.html b/_includes/head.html index f699da5..435a745 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -2,8 +2,17 @@ - {% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %} - + + {% if page.title -%} + {{- page.title | escape -}} + {%- else -%} + {{- site.title | escape -}} + {%- endif %} + + - + {% seo %} diff --git a/_includes/header.html b/_includes/header.html index 66777a3..bfc2874 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -10,10 +10,14 @@

    {{ site.title }}

    -
  • {% t connect.subscribe %}
  • +
  • + {% t connect.subscribe %} +
  • diff --git a/_includes/links.html b/_includes/links.html index 7977975..c61212e 100644 --- a/_includes/links.html +++ b/_includes/links.html @@ -1,19 +1,19 @@ {% unless page.hide_form %}