From 593e8524c613f81f42c674a06cabeb801a997ddd Mon Sep 17 00:00:00 2001 From: Lundy Bernard Date: Sat, 18 Jul 2026 17:26:44 +0000 Subject: [PATCH] feat(copier): Enable updates from template Allows users to run `copier update` to pull theme changes. Files they customise (Makefile, myst.yml, index.md, about.md, news.md) are seeded once and never overwritten. include_news makes the news page optional at init. Assisted-by: claude-code:claude-fable-5 Assisted-by: claude-code:claude-opus-4-8 --- copier.yml | 24 ++++++++++++++++++++++++ template/myst.yml.jinja | 2 ++ 2 files changed, 26 insertions(+) diff --git a/copier.yml b/copier.yml index 4872dab..9f825f4 100644 --- a/copier.yml +++ b/copier.yml @@ -1,5 +1,24 @@ _subdirectory: template +# Scaffold files rendered on the first `copier copy`, but never overwritten on +# `copier update`: consumers customise these and own them thereafter. If a file +# already exists on first copy, copier keeps the existing file. +_skip_if_exists: + - Makefile + - myst.yml + - index.md + - about.md + - news.md + +# Optional scaffold, decided on the first `copier copy`. When include_news is +# false, the pattern renders to "news.md" and copier excludes the file; when +# true, it renders empty and matches nothing. Do not flip the answer on +# `copier update`: a flip to false deletes news.md, and myst.yml keeps its +# News nav entry because myst.yml is in `_skip_if_exists`. To remove news +# from an existing site, delete news.md and its nav entry by hand. +_exclude: + - "{% if not include_news %}news.md{% endif %}" + project_name: type: str help: what is your project name? @@ -17,3 +36,8 @@ favicon: type: str help: what is your project favicon? default: "https://raw.githubusercontent.com/scientific-python/scientific-python.org/main/static/favicon.ico" + +include_news: + type: bool + help: Include a news.md page? (affects the initial scaffold only) + default: true diff --git a/template/myst.yml.jinja b/template/myst.yml.jinja index fa73a0b..367d961 100644 --- a/template/myst.yml.jinja +++ b/template/myst.yml.jinja @@ -7,8 +7,10 @@ site: nav: - title: About url: /about +{% if include_news %} - title: News url: /news +{% endif %} options: favicon: assets/images/favicon.ico logo: assets/images/logo.svg