Decap CMS Configuration
Files
| File | Purpose |
|---|---|
public/admin/index.html |
Staff workspace (/admin/): a static task dashboard. Each card deep-links into the editor (for example /admin/edit/#/collections/events/entries/event_list). Includes a publishing explainer and a help section. No Decap code loads here. |
public/admin/workspace.css |
Styles for the workspace and the editor loading screen |
public/admin/workspace.js |
Redirects old Decap bookmarks (/admin/#/…) to /admin/edit/#/… |
public/admin/edit/index.html |
Editor (/admin/edit/): points Decap at /admin/config.yml via <link rel="cms-config-url">, shows a loading screen, and mounts Decap into #nc-root |
public/admin/editor-loader.js |
Injects Decap from unpkg, pinned to [email protected]. Hides the loading screen once Decap renders. After 20 s shows a slow-connection message, or an error message if the script fails to load. |
public/admin/config.yml |
Backend, media folders, and collections |
All admin pages are noindex, nofollow, and robots disallows /admin.
To upgrade Decap, change the pinned version in editor-loader.js, then test sign-in and every collection locally (npx decap-server) before deploying. An unpkg outage affects only the editor, never the public site.
The workspace cards hard-code collection and file names in their URLs. If you rename a collection or file entry in config.yml, update the matching card link in index.html.
Backend and authentication
backend:
name: github
repo: pmgasset/fortadamswebsite
branch: main
base_url: https://decap-oauth.fortadams.org # OAuth proxy
local_backend: true
site_url: https://www.fortadams.org
- There's no
publish_mode: editorial_workflow, so every Publish commits straight tomainand deploys. - The GitHub backend needs an OAuth proxy, because GitHub's OAuth flow requires a client secret. Setup:
- Create a GitHub OAuth App (org or user Settings → Developer settings → OAuth Apps). Set the callback URL to the proxy's callback endpoint.
- Deploy a proxy, for example the Cloudflare Worker
sterlingwes/decap-proxyori40west/netlify-cms-oauth, withGITHUB_OAUTH_CLIENT_IDandGITHUB_OAUTH_CLIENT_SECRET, ondecap-oauth.fortadams.org. - Keep
backend.base_urlpointing at it, and confirm the proxy is live before launch.
- Editors need write access to the repo.
Collections
The header comment in config.yml says it: keep collection, file, and field names stable, because they map to existing JSON keys and paths. Labels can change freely.
Collection label (name) |
File entry label (name) |
Target | Media folder |
|---|---|---|---|
Special Events (events) |
Add or update events (event_list) |
content/events.json |
public/images/events |
Event Categories (event_categories) |
content/event-categories.json |
||
Alerts & Booking (settings) |
Update the announcement banner (alert) |
content/alert.json |
global: public/images/staff |
Update tour booking links (tour_booking) |
content/tour-booking.json |
||
Staff & Board (staff) |
Update staff & board (directory) |
content/staff.json |
global: public/images/staff |
Sponsors & Partners (sponsors) |
Update sponsor recognition (annual_sponsors) |
content/sponsors.json |
public/images/sponsors |
All collections are file collections (one JSON file each, with list widgets) and set delete: false, so editors can't delete the underlying files. Global options: editor.preview: false (no preview pane), logo_url (the Trust logo on the login screen), and display_url pointing at /admin/. Lists are collapsed: true, required: false, default: [].
Notable field configuration:
- Alert message:
pattern: ^.{0,120}$. - Tour URLs: regex patterns (see FareHarbor Integration).
- Event
isPublished:default: false, so new events start hidden until the editor switches them on. - Event list:
add_to_top: true,allow_reorder: false(the site sorts by date). - Event category: a
relationwidget intoevent_categories(value_field: categories.*.name). It stores the name string, so renames don't cascade. - Event dates:
datetime,format: YYYY-MM-DDTHH:mm:ssZ,picker_utc: false, displayed asMMM D, YYYY/h:mm A. The stored offset comes from the editor's device time zone, hence the "set your device to Eastern Time" hint. - Event id: a
hiddenwidget, never set by Decap for new entries.getPublicEvents()generates one. - Event
externalUrl:^$|^https?://[^\s/?#]+[^\s]*$.bookingUrl:^$|^/(?!/)[^\s]*$(site paths only, no protocol-relative//). - Staff
email:^$|^[^\s@]+@[^\s@]+\.[^\s@]+$. - Sponsor
year:^[0-9]{4}$. Sponsorwebsite: same pattern as eventexternalUrl.add_to_top: true.
Adding a CMS-editable field or area
- Add the field to the JSON file in
content/with a sensible default, so existing data stays valid. - Update the TypeScript interface and loader in
src/lib/, treating the field as optional for older data. - Add the widget to
config.yml. Mirror the constraints withpattern,required, andhint. - Render it in the component.
- Test locally with
npx decap-server(see Local Development Setup), thennpm run build.
Keep new areas constrained: validated strings, booleans, lists, and images. Avoid rich-text or HTML fields that let editors break layouts or inject markup.
No comments to display
No comments to display