M_BLOG_NAME = 'Your Brand Blog'
M_BLOG_URL = 'blog/'
+The :py:`M_FAVICON` setting, if present, is used to specify contents of the
+:html:`<link rel="icon">` tag. It's a tuple of :py:`(url, type)` where
+:py:`url` is favicon URL and :py:`type` is its corresponding MIME type. If
+:py:`M_BLOG_FAVICON` is specified, it's overriding :py:`M_FAVICON` on blog-like
+pages (articles, article listing... basically everything except pages). If
+:py:`M_BLOG_FAVICON` is not specified, :py:`M_FAVICON` is used everywhere; if
+neither is specified no :html:`<link>` tag is rendered. Example configuration:
+
+.. code:: py
+
+ M_FAVICON = ('favicon.ico', 'image/x-ico')
+ M_BLOG_FAVICON = ('favicon-blog.png', 'image/png')
+
`Top navbar`_
-------------
{% block title %}{{ M_BLOG_NAME|e }}{% endblock %}
{% block head_links %}
+ {{- super() -}}
{% if articles_page and articles_page.has_previous() %}
<link rel="prev" href="{{ articles_previous_page.url|format_siteurl|e }}" />
{% endif %}
{% block title %}{{ article.title }} | {{ M_BLOG_NAME|e }}{% endblock %}
{% block head_links %}
+ {{- super() -}}
+ {# don't mind me, I'm just fixing whitespace from the previous line #}
<link rel="canonical" href="{{ article.url|format_siteurl|e }}" />
{% endblock %}
{% if not M_BLOG_NAME %}{% set M_BLOG_NAME = SITENAME %}{% endif %}
{% extends 'base.html' %}
+{% block head_links %}
+ {% if M_BLOG_FAVICON %}
+ <link rel="icon" href="{{ M_BLOG_FAVICON[0]|format_siteurl|e }}" type="{{ M_BLOG_FAVICON[1]|e }}" />
+ {% elif M_FAVICON %}
+ <link rel="icon" href="{{ M_FAVICON[0]|format_siteurl|e }}" type="{{ M_FAVICON[1]|e }}" />
+ {% endif %}
+{% endblock %}
+
{% block social %}
<meta property="og:site_name" content="{{ M_BLOG_NAME|e }}" />
{% endblock %}
{% extends "base_blog.html" %}
{% block head_links %}
+ {{- super() -}}
{% if articles_page.has_previous() %}
<link rel="prev" href="{{ articles_previous_page.url|format_siteurl|e }}" />
{% endif %}
<link rel="stylesheet" href="{{ style|expand_link(page)|e }}" />
{% endfor %}
{% endif %}
+ {% if M_FAVICON %}
+ <link rel="icon" href="{{ M_FAVICON[0]|format_siteurl|e }}" type="{{ M_FAVICON[1]|e }}" />
+ {% endif %}
<link rel="canonical" href="{{ page.url|format_siteurl|e }}" />
{% endblock %}
<title>A Pelican Blog</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon-blog.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="A Pelican Blog" />
<meta property="og:title" content="A Pelican Blog" />
<title>An article — a jumbo one | A Pelican Blog</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon-blog.ico" type="image/x-icon" />
<link rel="canonical" href="article-jumbo.html" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="A Pelican Blog" />
<title>An article | A Pelican Blog</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon-blog.ico" type="image/x-icon" />
<link rel="canonical" href="article.html" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Article description for the fake SEO believers." />
<title>Posts by Explicit Author | A Pelican Blog</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon-blog.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="A Pelican Blog" />
<meta property="og:title" content="Explicit Author" />
<title>Another category | A Pelican Blog</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon-blog.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="A Pelican Blog" />
<meta property="og:title" content="Another category" />
<title>A Pelican Blog</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon-blog.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="A Pelican Blog" />
<meta property="og:title" content="A Pelican Blog" />
<title>Posts tagged Third | A Pelican Blog</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon-blog.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="A Pelican Blog" />
<meta property="og:title" content="Third" />
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>A Pelican Blog</title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
+ <link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.png" type="image/png" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+ <div class="m-container">
+ <div class="m-row">
+ <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+ </div>
+ </div>
+</nav></header>
+<main>
+<div class="m-container">
+ <div class="m-row">
+ <div class="m-col-m-10">
+ <div class="m-note m-success">
+ <h3>Congratulations!</h3>
+ The m.css theme is alive and kicking! Now, feed it some articles so it doesn't feel so empty :)
+ </div>
+ </div>
+ <nav class="m-navpanel m-col-m-2">
+ <h3>Categories</h3>
+ <ol class="m-block-bar-m">
+ <li><em class="m-text m-dim">(none yet)</em></li>
+ </ol>
+ </nav>
+ </div>
+</div>
+</main>
+</body>
+</html>
<title><&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="next" href="index2.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title><&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="prev" href="index.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title>Article with <&> — a <&> jumbo one | <&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="canonical" href="article-jumbo.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="And <&> in description." />
<title>Article with <&> in title | <&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="canonical" href="article.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="And <&> in description." />
<title>Posts by And <&> in author | <&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="next" href="index2.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title>Posts by And <&> in author | <&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="prev" href="index.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title>And <&> in category | <&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="next" href="index2.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title>And <&> in category | <&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="prev" href="index.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title><&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="next" href="index2.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title><&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="prev" href="index.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title>Posts tagged And <&> in tag | <&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="next" href="index2.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title>Posts tagged And <&> in tag | <&> in blog name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="prev" href="index.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in blog name" />
<title>Features | Your Brand</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="canonical" href="features.html" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="Your Brand" />
<title>Guest post howto | Your Brand</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="canonical" href="guest-post-howto.html" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="Your Brand" />
<title>Your Brand Blog</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="Your Brand Blog" />
<meta property="og:title" content="Your Brand Blog" />
<title>Showcase requirements | Your Brand</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="canonical" href="showcase-requirements.html" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="Your Brand" />
<title>A <&> blog</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="A <&> blog" />
<meta property="og:title" content="A <&> blog" />
<title>And <&> in breadcrumb » Page with <&> in title | <&> in site name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="canonical" href="breadcrumb.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in site name" />
<title>Escaping in content | <&> in site name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="canonical" href="content.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in site name" />
<title><&> in site name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="canonical" href="landing.html?and&in&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:site_name" content="<&> in site name" />
<title>Page with <&> in title | <&> in site name</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
<link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="icon" href="favicon.ico?and&in&url=""" type="huh&what" />
<link rel="canonical" href="page.html?and&overriden&url=""" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="And <&> in description." />
'AUTHOR': "Implicit Author",
'STATIC_PATHS': ['ship.jpg'],
'M_BLOG_URL': 'archives.html',
+ 'M_FAVICON': ('favicon.png', 'image/png'),
+ 'M_BLOG_FAVICON': ('favicon-blog.ico', 'image/x-icon'),
'FORMATTED_FIELDS': ['summary', 'description']
})
'SITENAME': '<&> in site name',
'M_BLOG_NAME': '<&> in blog name',
'M_BLOG_URL': 'archives.html?and&in&url=""',
+ 'M_BLOG_FAVICON': ('favicon.ico?and&in&url=""', 'huh&what'),
'ARTICLE_URL': '{slug}.html?and&in&url=""',
'AUTHOR_URL': 'author-{slug}.html?and&in&url=""',
'CATEGORY_URL': 'category-{slug}.html?and&in&url=""',
self.assertEqual(*self.actual_expected_contents('article.html'))
self.assertEqual(*self.actual_expected_contents('article-jumbo.html'))
+
+class GlobalFavicon(BlogTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, 'global_favicon', *args, **kwargs)
+
+ def test(self):
+ self.run_pelican({
+ 'M_FAVICON': ('favicon.png', 'image/png'),
+ 'M_DISABLE_SOCIAL_META_TAGS': True
+ })
+
+ self.assertEqual(*self.actual_expected_contents('index.html'))
'SITENAME': 'Your Brand',
'M_BLOG_NAME': 'Your Brand Blog',
'M_SITE_LOGO_TEXT': 'Your.brand',
+ 'M_FAVICON': ('favicon.ico', 'image/x-icon'),
'M_LINKS_NAVBAR1': [
('Features', 'features.html', 'features', []),
('Showcase', '#', 'showcase', [
'M_BLOG_NAME': 'A <&> blog',
'M_SITE_LOGO': 'image.png?and&in&url=""',
'M_SITE_LOGO_TEXT': '<&>',
+ 'M_FAVICON': ('favicon.ico?and&in&url=""', 'huh&what'),
'M_LINKS_NAVBAR1': [
('An <&> item', 'item.html?and&in&url=""', '', [
('A <&> subitem', 'sub.html?and&in&url=""', '')]),
'PAGE_URL': '{slug}.html?and&in&url=""',
# The social meta tags should be escaped properly as well
'M_DISABLE_SOCIAL_META_TAGS': False,
+ 'M_FAVICON': ('favicon.ico?and&in&url=""', 'huh&what')
})
# Verify that everything is properly escaped everywhere. The landing
'PAGE_URL': '{slug}.html?and&in&url=""',
# The social meta tags should be escaped properly as well
'M_DISABLE_SOCIAL_META_TAGS': False,
+ 'M_FAVICON': ('favicon.ico?and&in&url=""', 'huh&what')
})
# Verify that also the Pelican-produced content has correctly escaped