| Oct | NOV | Dec |
| 01 | ||
| 2020 | 2021 | 2022 |
COLLECTED BY
Collection: Save Page Now Outlinks
Full Stack Python
All topics |
Blog |
Supporter's Edition |
@fullstackpython |
Facebook |
What's new?
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="author" content="Matt Makai"> <meta name="description" content="Template engines provide programmatic output of formatted content such as HTML, XML or PDF."> <link rel="shortcut icon" href="//static.fullstackpython.com/fsp-fav.png">Every one of the HTML lines above is standard for each page on Full Stack Python, with the exception of the
<meta name="description"... line which
provides a unique short description of what the individual page contains.
The
base.html Jinja template
used to generate Full Stack Python allows every page on the site to have
consistent HTML but dynamically generate the pieces that need to change
between pages when the static site generator
executes. The below code from the base.html template shows that the meta
description is up to child templates to generate.
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="author" content="Matt Makai"> {% block meta_header %}{% endblock %} <link rel="shortcut icon" href="//static.fullstackpython.com/fsp-fav.png">In a typical WSGI application, the template engine would generate the HTML output response when an HTTP request comes in for a particular URL.
format() function can implement a simple template engine
with conditionals, loops and method invocations.
When to use a Templating Engine (in Python)?
is a Stack Overflow question with a useful answer on why and when to
use an existing template engine.
Template Engines
uses Jinja as an implementation example to explain the tasks that
template engines can be used to perform.
Approach: Building a toy template engine in Python
walks through how to create your own simple template engine in Python
to understand the basics of how most template engines work.
The most accurate speech-to-text API. Built for Python developers.