Skip to content

Commit

Permalink
docs: eleventy configuration so I don't need to check the online doc …
Browse files Browse the repository at this point in the history
…too often
  • Loading branch information
marc-bouvier committed Jul 29, 2024
1 parent 1c565ce commit a46a547
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 16 deletions.
4 changes: 3 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import {eleventyImageTransformPlugin} from "@11ty/eleventy-img"
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"
import {EleventyI18nPlugin} from "@11ty/eleventy";
import {EleventyHtmlBasePlugin, EleventyI18nPlugin} from "@11ty/eleventy";
import {feedPlugin} from "@11ty/eleventy-plugin-rss";

export default function (eleventyConfig) {

// Copy static styles as is
eleventyConfig.addPassthroughCopy("public/css");

// Required to support --pathprefix
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);

// Internationalization
eleventyConfig.addPlugin(EleventyI18nPlugin, {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-to-ghpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: npm install

- name: Build static site
run: npm run build -- --pathprefix=green-a11y-11ty/
run: npm run build:gh-pages

- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v4
Expand Down
65 changes: 52 additions & 13 deletions Making-of.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,35 +310,58 @@ I will create a github pages workflow so I can quickly have a real preview of my

https://pages.github.com/

I will create a Github Action that wil generate my static site and host it in Github Pages.
In Github, there is no pre-made template for eleventy.

First, I go to the Actions section of my repository.
Let's see if we can find something at https://11ty.dev

In my case I find it here : https://github.com/marc-bouvier/green-a11y-11ty/actions
https://www.11ty.dev/docs/deployment/#jamstack-providers

Since I don't have any actions yet, it invites me to create a new one form a template or from scratch.
There is a mini tutorial for deploying an 11ty site on Github Pages : https://www.11ty.dev/docs/deployment/#deploy-an-eleventy-project-to-github-pages

A github actions is defined with a yml file.
My Github page will be hosted to `https://marc-bouvier.github.io/green-a11y-11ty/`.

This file describes the various steps of a pipeline.
It is a subfolder root.

We can find templates specific to the Github Pages in the "Pages" category : https://github.com/marc-bouvier/green-a11y-11ty/actions/new?category=pages
I need to support `--pathprefix` argument when I build this site for Github Pages.

There is no pre-made template for eleventy.
First, let's add a plugin to eleventy configuration to support using `--pathprefix`.

Let's see if we can find something at https://11ty.dev
.eleventy.js

https://www.11ty.dev/docs/deployment/#jamstack-providers
```diff
-import {EleventyI18nPlugin} from "@11ty/eleventy";
+import {EleventyHtmlBasePlugin, EleventyI18nPlugin} from "@11ty/eleventy";

export default function (eleventyConfig) {

There is a mini tutorial for deploying an 11ty site on Github Pages : https://www.11ty.dev/docs/deployment/#deploy-an-eleventy-project-to-github-pages
+ // Required to support --pathprefix
+ eleventyConfig.addPlugin(EleventyHtmlBasePlugin);

First I will create a git branch named `gh-pages`
}

```

A Github Action will generate my static site and host it in Github Pages.

First, I go to the Actions section of my repository.

In my case I find it here : https://github.com/marc-bouvier/green-a11y-11ty/actions

Since I don't have any actions yet, it invites me to create a new one form a template or from scratch.

A GitHub action is defined with a yml file located in `.github/workflows/`.

This file describes the various steps of a pipeline.

We can find templates specific to the GitHub Pages in the "Pages" category : https://github.com/marc-bouvier/green-a11y-11ty/actions/new?category=pages

First I will create a git branch named `gh-pages`

.github/workflows/deploy-to-ghpages.yml

{% comment %}
TODO: find a way to show this file properly in both the text and rendered.

```yaml
name: Deploy to GitHub Pages

Expand Down Expand Up @@ -394,9 +417,25 @@ jobs:

## Next time

- navigation
- Items
- Blog posts
- Notes (micro blogging)
- About
- Rss
- Podcasts
- Liens sortants (sites que j'aime bien ou ami-e-s)
- Bibliothèque (inspiration de https://lazybear.io/)
- A11y : Skip to content
- A11y : Skip to navigation

- écriture inclusive
- choisir une façon d'écrire mon contenu de façon inclusive (inspiration : [La lutine du web](https://www.lalutineduweb.fr/), ...)
-

I can pick one of the following stuff.

- Links followable in blogs
- Links followable in blogs

- Host statically on Github pages for public preview
- Reading time : https://github.com/johanbrook/eleventy-plugin-reading-time
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"type": "module",
"scripts": {
"start": "eleventy --serve",
"build": "eleventy"
"build": "eleventy",
"build:gh-pages": "eleventy --pathprefix='/green-a11y-11ty/'"
},
"devDependencies": {
"@11ty/eleventy": "^3.0.0-alpha.17",
Expand Down

0 comments on commit a46a547

Please sign in to comment.