Commit ded4cec
committed
✨ Template |
Several files in generated packages benefit from knowing the source repository
URL: the MkDocs/MyST docs sites get a header link to the repo, `pyproject.toml`
gets `[project.urls]` entries that surface on PyPI, and other downstream uses
(README badges, changelog commit links) can hook into the same value. Today the
URL is hardcoded in a few places or missing entirely, and there's no single
source of truth users can set without editing template output by hand.
Add a hidden `repo_url` Copier question (default empty, `when: false`) so
nothing is prompted on initial copy — the template still works fine without a
remote — and wire it into:
- `mkdocs.yml.jinja`: `repo_url`, `repo_name` (derived via Jinja from the URL),
and the Material GitHub icon, all wrapped in `{% if repo_url %}` so empty
values render a clean config.
- `myst.yml.jinja`: set `github:` to `repo_url` when present; keep the existing
commented-out placeholder otherwise.
- `pyproject.toml.jinja`: add `[project.urls]` with `Repository` and `Issues`
entries (the well-known PyPI labels) when `repo_url` is set.
Document the workflow in `docs/index.md` next steps: users create the remote,
then run `copier update -A -d repo_url=https://github.com/<user>/<repo>` to
populate every wired-in spot in one shot. The `-A` (`--skip-answered`) flag
keeps the update non-interactive for already-answered questions, mirroring the
pattern already used by the hidden `auto_update` question.repo_url: add repository URL to generated files1 parent 29ca952 commit ded4cec
5 files changed
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
62 | 76 | | |
63 | 77 | | |
64 | 78 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
5 | 13 | | |
6 | 14 | | |
7 | 15 | | |
| |||
0 commit comments