chiark / gitweb /
theme: charset meta tag should be first in head.
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 29 Oct 2017 20:47:42 +0000 (21:47 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Sun, 29 Oct 2017 20:49:22 +0000 (21:49 +0100)
Huh. Makes sense. Reported by https://sonarwhal.com/scanner/.

doc/css/page-layout.rst
pelican-theme/templates/base.html

index 2fd86211459714cf1a3e37071912315d08298699..0a1765b9646fb915ea0f529305f9278e6e9c6c2b 100644 (file)
@@ -45,7 +45,8 @@ more.
 
 A barebones HTML markup structure using ``m.css`` looks like below. There is
 the usual preamble, with :html:`<html lang="en">` and a :html:`<meta>` tag
-specifying the file encoding. Some browsers assume UTF-8 by default (as per the
+specifying the file encoding, which should be the first thing in :html:`<head>`.
+Some browsers assume UTF-8 by default (as per the
 `HTML5 standard <https://www.w3schools.com/html/html_charset.asp>`__), but some
 not, so it's better to always include it. In the :html:`<head>`
 element it's important to also specify that the site is responsive via the
@@ -61,10 +62,10 @@ have to stick to the shown structure.
     <!DOCTYPE html>
     <html lang="en">
       <head>
+        <meta charset="UTF-8" />
         <title>Page title</title>
         <link rel="stylesheet" href="m-dark.css" />
         <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-        <meta charset="UTF-8" />
       </head>
       <body>
         <header><nav>
index 3da48a596985b2a679e7695ec9e780cc8d080dc4..430f06e74fb5afae7e00478731443a7ffe8dc068 100644 (file)
@@ -2,6 +2,7 @@
 <html lang="{{ DEFAULT_LANG }}">
 <head>
   {% block head %}
+  <meta charset="UTF-8" />
   <title>{% block title %}{{ SITENAME }}{% endblock title %}</title>
   {% for href in CSS_FILES %}
   <link rel="stylesheet" href="{{ href|format_siteurl }}" />
@@ -10,7 +11,6 @@
   {% if THEME_COLOR %}
   <meta name="theme-color" content="{{ THEME_COLOR }}" />
   {% endif %}
-  <meta charset="UTF-8" />
   {% if FEED_ALL_ATOM_URL %}
   <link href="{{ FEED_ALL_ATOM_URL }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }}" />
   {% endif %}