Skip to content

[FEATURE] Make templates overridable#1190

Open
CybotTM wants to merge 3 commits into
TYPO3-Documentation:mainfrom
CybotTM:feature/overridable-templates
Open

[FEATURE] Make templates overridable#1190
CybotTM wants to merge 3 commits into
TYPO3-Documentation:mainfrom
CybotTM:feature/overridable-templates

Conversation

@CybotTM
Copy link
Copy Markdown
Contributor

@CybotTM CybotTM commented Feb 25, 2026

Lets you override the theme's Twig templates without rebuilding the container, useful for local rendering and custom CI pipelines.

Two override directories are checked, both prepended to the Twig search path so they win over the built-in templates:

  1. /templates — mounted via Docker volume (highest priority)
  2. resources/custom-templates — bundled in the project repo

Templates rendered by the central docs.typo3.org pipeline are unaffected: that runs a fixed image and never sees these directories.

Continues #1085 by @linawolf, picking up the path and entrypoint fixes discussed there with @jaapio and @kaystrobach.

@linawolf
Copy link
Copy Markdown
Member

linawolf commented Mar 1, 2026

@kaystrobach would this solution work for you?

@kaystrobach
Copy link
Copy Markdown

kaystrobach commented Mar 1, 2026

Good from reading. Only question left is how to add own logos / css etc.

we can do this after rendering with cp but this feels „hacky“ using the resources folder feels more natural for that. That would be the only missing point from my POV.

removing leftovers files is more a task for external cleanup (should not be done in the container)

@CybotTM CybotTM force-pushed the feature/overridable-templates branch from 52c03ca to a3ee246 Compare March 9, 2026 00:25
@CybotTM CybotTM force-pushed the feature/overridable-templates branch from a3ee246 to 2495f38 Compare April 16, 2026 21:43
@CybotTM CybotTM force-pushed the feature/overridable-templates branch from 2495f38 to 3f39239 Compare May 14, 2026 06:17
@CybotTM
Copy link
Copy Markdown
Contributor Author

CybotTM commented May 14, 2026

We can do the asset copy in this PR or in a follow-up ... your call @linawolf

CybotTM added 3 commits May 14, 2026 10:11
Allow users to override Twig templates when rendering documentation
locally via Docker or a custom CI pipeline, without modifying the
container image.

Two override methods are supported:

1. Docker volume mount at ``/templates`` (highest priority)
2. Project-bundled templates at ``resources/custom-templates``

The theme extension detects these directories and prepends them to
the template search path, so custom templates take precedence over
the built-in theme templates.

Continues the work from TYPO3-Documentation#1085 by @linawolf.

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
- Add :caption: to every code-block in the Templating page
- Replace the four-row list-table of container paths with a
  description list, so file paths fit under 80 chars
- Rewrite the shell copy examples to use TMPL / SRC variables,
  bringing the shell lines under 80 chars and letting the same
  variable drive both source and target paths

One ``:file:`` line stays at 82 chars because the
``guides-restructured-text`` path is 70 chars on its own and the
``:file:`` role cannot be broken across lines.

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
@CybotTM CybotTM force-pushed the feature/overridable-templates branch from c30e6d9 to 71df316 Compare May 14, 2026 08:11
@kaystrobach
Copy link
Copy Markdown

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants