Skip to content

feat: Add validity support for CMS + bug fixes - #1156

Open
MoritzWeber0 wants to merge 7 commits into
mainfrom
feat/validity-decap
Open

feat: Add validity support for CMS + bug fixes#1156
MoritzWeber0 wants to merge 7 commits into
mainfrom
feat/validity-decap

Conversation

@MoritzWeber0

@MoritzWeber0 MoritzWeber0 commented Aug 16, 2026

Copy link
Copy Markdown
Member
  • Add support for editing the FIP validity table in the CMS, groups are no longer defined as YAML anchor, but as normal keys in the YAML itself.

    image
  • Auto-enable local_backend when running locally (it detects a running npx decap-server server), see https://decapcms.org/docs/decap-proxy/

  • Add support for targeting different branches (edit page on the preview uses the correct branch, not main)

  • Update the highlight syntax again to avoid page modifications

Resolves #919

@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploy Preview for fipguide ready!

Name Link
🔨 Latest commit 0b81f0d
🔍 Latest deploy log https://app.netlify.com/projects/fipguide/deploys/6a8201f360f4310008ff3c7c
😎 Deploy Preview https://deploy-preview-1156--fipguide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown

Hi there! 👋

Thank you for your contribution to the FIP Guide! 🚀
We appreciate your effort in making rail staff travel information more accessible. 🚄

Checklist before merging:

  • Added a description to the Pull Request
  • Checked the License of new pictures (non-commercial use without attribution)
  • Modified content in English
  • Modified content in German
  • Modified content in French

- Add fip-validity-select and fip-validity-link custom Decap widgets,
  and a new FIP Validity Tables collection for editing the groups and
  operators data in each issuer's validity.yaml
- Filter validity dropdowns by group type (FIP Coupon vs Reduced
  Ticket); sort the operators map alphabetically on save
- Allow creating new FIP Validity Table entries via Decap's meta.path
  mechanism, and link to the matching table from the FIP Application
  page's fip-validity-table shortcode
- Rename fip-validity-widget.js to widget.js
- Generate the Operators field list in the admin config from
  content/operator via a Hugo-templated layouts/admin/section.cmsconfig.yml
  instead of a hand-maintained list in static/admin/config.yml
- Exclude the new template from the check-yaml pre-commit hook via
  prek's glob exclude syntax, since it's Go template source, not
  plain YAML
- Re-save validity.yaml files through the CMS to backfill the new
  type field on existing validity groups
Set hide: true on the fip-validity collection so it no longer appears
in the sidebar nav or as the default landing collection, while
staying fully reachable via the FIP Application shortcode's direct
link and its own entry URLs.
@MoritzWeber0 MoritzWeber0 changed the title refactor: flatten validity.yaml schema and simplify partials feat: Add validity support for DecapCMS + many CMS bug fixes Aug 16, 2026
@MoritzWeber0 MoritzWeber0 changed the title feat: Add validity support for DecapCMS + many CMS bug fixes feat: Add validity support for CMS + many CMS bug fixes Aug 16, 2026
- Only emit local_backend: true when hugo.IsServer is true, so it
  never appears in production/preview builds, only local dev
- Derive the Decap backend branch from a FIPGUIDE_BRANCH env var
  instead of hardcoding main, falling back to main when unset
- Whitelist the FIPGUIDE_ prefix in hugo.yaml's security.funcs.getenv,
  since os.Getenv is deny-by-default for anything outside HUGO_/CI
- Populate FIPGUIDE_BRANCH from Netlify's own  in the build
  command, and from github.ref_name in the Pages deploy workflow
highlight and highlight-raw were both registered with the identical
bracket-agnostic pattern shortcodePattern("highlight"), which matches
either {{% %}} or {{< >}} syntax. Decap's markdown parser tries every
globally registered editor component's pattern (not just the ones
listed in a field's own editor_components) and picks whichever
matches first via Immutable Map iteration, whose order isn't
guaranteed to follow registration order. That let a {{% highlight %}}
block get mistakenly tagged as highlight-raw on parse, which then
serialized back out as {{< highlight >}} on save.

shortcodePattern now takes an optional bracket argument so highlight
only matches %-delimited shortcodes and highlight-raw only matches
<-delimited ones, making the two mutually exclusive. Existing callers
that omit the argument keep the original bracket-agnostic behavior.
@MoritzWeber0
MoritzWeber0 marked this pull request as ready for review August 16, 2026 18:22
@MoritzWeber0
MoritzWeber0 requested a review from lenderom August 16, 2026 18:23
@MoritzWeber0 MoritzWeber0 changed the title feat: Add validity support for CMS + many CMS bug fixes feat: Add validity support for CMS + bug fixes Aug 16, 2026
Netlify's $BRANCH is documented as the git ref checked out for the
build, not necessarily a plain branch name. For PR-triggered deploy
previews it can resolve to a checkout ref like pull/1156/head, which
isn't a real branch Decap's GitHub backend can point to. $HEAD is
documented as the actual head branch name from the Git provider, so
use that instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add validation & formatting for validity.yaml

1 participant