diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7e1e84ed..019cdbdd 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -53,7 +53,10 @@ jobs: python-version: '3.12' - name: Install dependencies - run: pip install pyyaml + # pillow: bin/check-content reads every person photo to warn about + # one with no colour. Without it the check runs and says it skipped + # that. + run: pip install pyyaml pillow - name: Check front matter and cross-references run: bin/check-content diff --git a/.gitignore b/.gitignore index 241b2915..7f4f2d85 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,8 @@ public/** docs/ resources/ .hugo_build.lock + +# The checks in bin/ are Python scripts, so running one leaves a cache next +# to it. It was ignored only by one machine's global gitignore, which does +# not travel with the repository. +bin/__pycache__/ diff --git a/README.md b/README.md index 24a88c78..fc3fa407 100644 --- a/README.md +++ b/README.md @@ -40,10 +40,20 @@ The MarkDown file for the sponsor will have a FrontMatter section with the follo - `id`: Unique identifier of this sponsor. Should be a string without spaces, preferrably kebab-case. - `name`: Sponsor's name to be shown in all renderings. - `logo_image`: File name for the sponsor logo, which must be under `themes/pybcn_theme/assets/images/sponsors/`. An external URL is not accepted: copy the file into the repository. The template loads it with `resources.Get`, so a file under `static/` is not found, and `bin/check-content` reports it as an error. -- `url`: URL for the sponsor web page. -- `twitter`: URL for the sponsor's twitter account. +- `site`: URL of the sponsor home page. Leave it out when there is nothing to + link to, and the logo renders without a link. It follows the same rules as a + person's `site`, below, and one function checks both. -After this FrontMatter section, any valid MarkDown will be considered generic content to be shown in detail view. +**Those four are every field a sponsor has.** A sponsor renders as its logo, +linked to its site, and there is no page per sponsor, so nothing else in the +file reaches a reader. `bin/check-content` rejects any other field, and rejects +an empty value: 32 files carried a `twitter`, `linkedin`, `mastodont` or +`instagram` URL that had never been published, written by somebody who expected +it to show. + +There is no detail view, so a body under the front matter is never published. +Put a note about the sponsor in a comment in the front matter instead, where it +is clearly a note. Finally, add this sponsor to the sponsors list in the corresponding level of the desired sponsors page, like `content/sponsors/_index.md`, for the main sponsors page; `content/pyladies_bcn/sponsors.md`, for the PyLadies BCN Sponsors' page; or the specific event, if appropriate. @@ -96,12 +106,16 @@ A change to this site goes through a pull request. Nothing is pushed to 5. Run the three checks locally, so you find what the pull request would find: ``` - pip install pyyaml + pip install pyyaml pillow bin/check-content bin/check-html-safety bin/hugo --minify -D -d public && bin/check-rendered ``` + Pillow is only needed for the black and white photo check. Without it the + rest still runs and the check says it was skipped, so a missing Pillow + never fails a build for the wrong reason. + 6. Open the pull request against `edition`. The `pr-checks` workflow then runs the same checks on your branch, plus a build @@ -114,9 +128,9 @@ What each check is for: | Check | Fails when | |---|---| | Build the site | Hugo cannot build, or emits a warning | -| `bin/check-content` | Front matter does not parse, a person `id` does not match its filename, an id is duplicated, a declared photo is missing, or an event references a person or sponsor that does not exist | +| `bin/check-content` | Front matter does not parse, a person `id` does not match its filename, an id is duplicated, a declared photo is missing, an event references a person or sponsor that does not exist, a social URL has the wrong shape, or a field is empty. It warns, without failing, about a photo that is too small or has no colour | | `bin/check-html-safety` | Content carries raw HTML that turns a content change into script execution, a redirect, a credential prompt, or a page overlay | -| `bin/check-rendered` | The built pages carry that same markup, which catches a template that produces it even when no content file does | +| `bin/check-rendered` | The built pages carry that same markup, which catches a template that produces it even when no content file does, or they link to anything over `http` | | Check the links | Reported, never blocking, because external sites rate-limit | A merge to `edition` deploys the site. The `github-pages` workflow builds it and @@ -165,8 +179,15 @@ decoded, the way a browser does), an inline `