Skip to content

Add Best Practice guideline for partials/include #8608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions best_practices/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ scattered through lots of bundles.

Use lowercased snake_case for directory and template names.

.. best-practice::

Use a prefixed underscore for partial templates in template names.

You often want to reuse template code using the ``include`` function to avoid
redundant code. To determine those partials easily in the filesystem you should
prefix partials and any other template without HTML body or ``extends`` tag
with a single underscore.

Twig Extensions
---------------

Expand Down