begin take action page

This commit is contained in:
chrisbell committed 2026-11-22 13:23:26 -06:00
1 parent e3e291b8cf
commit 1c38a7bdb0
75 files changed
+496 -1

No files matched your search

+47
View File
@@ -7,6 +7,7 @@ from pathlib import Path
import frontmatter
from jinja2 import Environment, FileSystemLoader, select_autoescape
import yaml
from config import NAV, SITE
@@ -45,6 +46,52 @@ def build() -> None:
)
write(TMP, url, html)
state = (
yaml.safe_load((ROOT / "data" / "state.yaml").read_text(encoding="utf-8"))
or {}
)
counties = [
yaml.safe_load(p.read_text(encoding="utf-8"))
for p in sorted((ROOT / "data" / "counties").glob("*.yaml"))
]
for c in counties:
c["url"] = f"/act/{c['slug']}-county/"
map_file = STATIC / "assets" / "alabama-counties.svg"
map_svg = map_file.read_text(encoding="utf-8") if map_file.exists() else None
write(
TMP,
"/act/",
env.get_template("act.html").render(
**common,
url="/act/",
state=state,
counties=counties,
map_svg=map_svg,
meta={
"title": "Take Action",
"description": "Find your representatives and county, and how to contact them.",
},
),
)
county_tpl = env.get_template("county.html")
for c in counties:
write(
TMP,
c["url"],
county_tpl.render(
**common,
url=c["url"],
county=c,
meta={
"title": f"{c['name']} County, Alabama",
"description": f"Representatives, local groups, and ways to take action in {c['name']} County, Alabama.",
},
),
)
(TMP / "404.html").write_text(
env.get_template("404.html").render(
**common, url="/404.html", meta={"title": "Page not found", "noindex": True}