Skip to content

Commit 75cbe7e

Browse files
committed
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
1 parent 9002ff6 commit 75cbe7e

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

copier.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
_subdirectory: template
22

3+
# Scaffold files rendered on the first `copier copy`, but never overwritten on
4+
# `copier update`: consumers customise these and own them thereafter. If a file
5+
# already exists on first copy, copier keeps the existing file.
6+
_skip_if_exists:
7+
- Makefile
8+
- myst.yml
9+
- index.md
10+
- about.md
11+
- news.md
12+
13+
# Optional scaffold, decided on the first `copier copy`. When include_news is
14+
# false, the pattern renders to "news.md" and copier excludes the file; when
15+
# true, it renders empty and matches nothing. Do not flip the answer on
16+
# `copier update`: a flip to false deletes news.md, and myst.yml keeps its
17+
# News nav entry because myst.yml is in `_skip_if_exists`. To remove news
18+
# from an existing site, delete news.md and its nav entry by hand.
19+
_exclude:
20+
- "{% if not include_news %}news.md{% endif %}"
21+
322
project_name:
423
type: str
524
help: what is your project name?
@@ -17,3 +36,8 @@ favicon:
1736
type: str
1837
help: what is your project favicon?
1938
default: "https://raw.githubusercontent.com/scientific-python/scientific-python.org/main/static/favicon.ico"
39+
40+
include_news:
41+
type: bool
42+
help: Include a news.md page? (affects the initial scaffold only)
43+
default: true
File renamed without changes.

template/myst.yml.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ site:
77
nav:
88
- title: About
99
url: /about
10+
{% if include_news %}
1011
- title: News
1112
url: /news
13+
{% endif %}
1214
options:
1315
favicon: assets/images/favicon.ico
1416
logo: assets/images/logo.svg

0 commit comments

Comments
 (0)