evangelism-tracts

Gospel Zone

Gospel Zone is a static, mobile-first site of evangelism and discipleship tracts. Tract and church files are the content. A small Node script turns them into HTML and QR codes for https://gospel.zone/.

There is no client-side framework, no web fonts, and no analytics. The only runtime dependency is qrcode, used at build time.

Structure

content/site.json                         site name and the default footer
content/about.json                        About page sections
content/tracts/<slug>.json                one tract
content/churches/<slug>.json              one church
site.config.json                          public base URL for QR codes
src/build.js                              generates dist/
src/preview.js                            local static server
src/site.css                              the only stylesheet
.github/workflows/pages.yml               test, build, and deploy
dist/                                     build output (not committed)

The build writes two kinds of site:

Each edition has:

Page Path
Tract index, with QR codes / and /c/<church-slug>/
Old index address /qr/ and /c/<church-slug>/qr/ redirect to that index
About /about/ and /c/<church-slug>/about/
A tract /tracts/<slug>/ and /c/<church-slug>/tracts/<slug>/

SVG and PNG QR codes are written next to each edition, under assets/qr/. The index page shows the code, the URL it encodes, and download links for both files.

In-site links are relative, so the same HTML works from a local preview and from the root of gospel.zone. There is no /evangelism-tracts/ prefix. QR codes, canonical URLs, and Open Graph URLs use the absolute base URL.

Local build and preview

Requires Node 20 or newer.

npm install
npm test
npm run build
npm run preview

npm run build is the one command that writes the site. It checks every content file first and exits with an error if a tract or church is invalid. npm test runs those checks, builds the site, and decodes a root QR code and a church QR code.

Then open http://127.0.0.1:4173/. Preview the sample church at http://127.0.0.1:4173/c/sample-grace-fellowship/.

QR base URL

QR codes must point at the public tract, not at localhost. The public site is the root of https://gospel.zone/. A root tract is https://gospel.zone/tracts/<slug>/. A church tract is https://gospel.zone/c/<church-slug>/tracts/<slug>/.

The URL is a single setting:

  1. baseUrl in site.config.json (default https://gospel.zone/).
  2. The SITE_BASE_URL environment variable, when it is set to a non-empty value. This overrides the file. An empty value keeps the default.

The workflow passes the repository variable SITE_BASE_URL through. Leave that variable empty so deploys keep https://gospel.zone/.

The build also writes dist/CNAME from that origin (gospel.zone). GitHub Pages reads it from the deployed folder, so the custom domain stays in place after each deploy. The same name is in the repository CNAME file.

If baseUrl changes again, run npm run build and reprint every QR code. The codes are fixed at build time. An old printout still opens whatever address was current when it was made.

Add a tract

Add one file, content/tracts/<slug>.json. The filename and the slug field match. Then run npm run build.

Required fields are slug, title, category (salvation, discipleship, or doctrine), summary, and sections (an ordered list). Each section has a heading and at least one of paragraphs, points, scriptures (reference and text), prayer, or steps. Optional kind is prose, scripture, prayer, or steps. Optional marker replaces the section number (for example a). Set numbered to false when a section should have no badge. Optional summaryLine is a plain-language line shown above the section paragraphs. Optional points is a short list, used for an at-a-glance summary. Set collapseScriptures to true to put that section’s verses in a tap-to-open disclosure. Optional diagram is seven-ages, a CSS-only succession of seven ages from Creation to the Reign of Christ on earth. Every Bible quotation on this site is from the King James Version. When a tract quotes scripture, set translation.id to KJV and translation.name to King James Version. A verse is captioned with its reference only, such as Romans 3:23. The build adds one fine-print line at the end of every tract: “All Scripture quotations are from the Authorised King James Version.” translation.note is optional, is not printed, and if present must still name the King James Version. The build fails if a tract declares or mentions any other translation.

About page

content/about.json is an ordered sections list, so later sections are another entry in that file. A statement section has text and is shown as the opening statement. A prose section has paragraphs and an optional heading. The general edition serves it at /about/. Each church edition serves the same text at /c/<church-slug>/about/, with that church’s footer. The site header links to the About page for the edition you are reading.

No HTML page is written by hand. The index and the tract pages, including each church copy, pick the new file up on the next build.

Add a church

Add one file, content/churches/<slug>.json. Then run npm run build.

Required fields are slug, name, sample (true or false), address (a string or a list of lines), phone, email, website, and serviceTimes. Set sample to false for a real church. The included sample-grace-fellowship file is example data: a reserved example.org address and a 555 phone number, and every page under /c/sample-grace-fellowship/ says so.

The new edition is /c/<slug>/: that church’s index, with its own QR codes and footer. /c/<slug>/qr/ redirects there. The QR codes encode /c/<slug>/tracts/<tract-slug>/, so a scan shows that church’s contact details.

Deployment

Pushing to main runs .github/workflows/pages.yml. The workflow installs dependencies, runs npm test, builds dist/, and deploys that folder with GitHub Pages actions.

In the repository settings, Pages → Build and deployment → Source must be GitHub Actions. This repository already has Pages turned on, and it is currently publishing the branch through Jekyll (the live URL serves the README). The Actions deploy will not take over until an admin switches that source. This repo is private. GitHub Pages on a private repository needs a plan that includes private Pages; the Pages feature is already enabled here.

The Actions artifact is the dist/ folder, including dist/CNAME. Pages should use the custom domain gospel.zone. If baseUrl changes, rebuild and reprint the QR codes before handing out new copies.

Technical choices