Templates
HTML Head
This section describes the structure and purpose of the HTML
block in a Twig-powered web template.
Purpose
The <head>
section sets essential meta information for the browser, such as character encoding, responsive behavior, and page title. It also links the main stylesheet. Twig variables are used to dynamically populate these values from the configuration or runtime data.
Template Code
<!DOCTYPE html>
<html lang="{{ settings.language }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ title }} - {{ site_title }}</title>
<link rel="stylesheet" href="{{themepath}}/css/style.css">
</head>
Line by Line breakdown
Line | Explanation |
---|---|
<!DOCTYPE html> |
Declares HTML5 as the document type. |
<html lang="{{ settings.language }}"> |
Sets the document language using a dynamic Twig variable from the settings array (e.g. "en" , "de" ). |
<meta charset="UTF-8"> |
Defines UTF-8 as the character encoding. |
<meta name="viewport"...> |
Ensures mobile responsiveness and proper scaling on all devices. |
<title>{{ title }} - {{ site_title }}</title> |
Constructs the HTML page title dynamically. • title : Page-specific title (e.g., "About" )• site_title : Global site title (e.g., "My Blog" ) |
<link rel="stylesheet"...> |
Links to the main stylesheet. themepath should point to the active theme directory (e.g. /userdata/template/basic ). |
- Previous
- File Structure
- Next
- Navigation