liveBook · Manning

Subtemplate

A subtemplate is a reusable template fragment that can be rendered independently or included within another template to produce part of an output.

How 3 Manning books explain it

Django in Action

A subtemplate is a reusable template fragment that can be rendered independently as an HTML response segment or included in another template.

How it is used
Composes Django pages from reusable HTML fragments and supplies targeted HTMX response segments.
How deep it goes
Explains inclusion, passed context, conditional markup, and request-dependent partial rendering without detailing template-engine internals.
Examples
Uses blog fragments, a pagination footer, musician search results, and editable venue-room rows.
What you can do after
Apply it via Django {% include %} to reuse markup and return focused HTMX updates.

Read how Django in Action explains subtemplate →

ASP.NET Core in Action, 3e

A partial Razor view is a reusable Razor view fragment that can be rendered within another view or layout.

How it is used
Reduces duplicated Razor markup and splits large views into reusable rendering fragments.
How deep it goes
Explains partial models, rendering with the partial Tag Helper, and lookup by name.
Examples
Uses a reusable to-do item fragment and a login-links partial rendered by a default layout.
What you can do after
Apply it via the Razor partial Tag Helper to render a reusable fragment with a model.

Read how ASP.NET Core in Action, 3e explains subtemplate →

Pro ASP.NET Core 7, Tenth Edition

A partial view is a reusable view fragment containing markup and Razor directives that receives its data from a parent view.

How it is used
Reuses HTML and Razor fragments across parent views without copying markup.
How deep it goes
Works through CSHTML creation, tag-helper setup, model passing, nested partials, and lookup; defers detailed tag-helper treatment.
Examples
Uses product-summary cards, product-table rows, a nested table cell, shared product details, and form-validation markup.
What you can do after
Build it from scratch as a CSHTML partial and apply it in MVC views or Razor Pages.

Read how Pro ASP.NET Core 7, Tenth Edition explains subtemplate →

What to know first

Related concepts

Questions about subtemplate

What is subtemplate?

A subtemplate is a reusable template fragment that can be rendered independently or included within another template to produce part of an output.

Which Manning books explain subtemplate?

Django in Action, ASP.NET Core in Action, 3e and Pro ASP.NET Core 7, Tenth Edition.

What should I know before learning subtemplate?

Manning books that teach subtemplate usually introduce HTML, CSS, PageModel and Razor Pages first.

What is the difference between subtemplate and view component?

A subtemplate is a reusable template fragment that can be rendered independently or included within another template to produce part of an output. A view component is a reusable user-interface unit that encapsulates presentation logic for rendering a portion of a page or response.

What is subtemplate part of?

Subtemplate is part of HTML. HTML is the standard markup language for structuring content and elements in documents on the web.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.