pelicanconf.py

Thu, 10 Nov 2022 18:52:14 +0100

author
David Douard <david.douard@logilab.fr>
date
Thu, 10 Nov 2022 18:52:14 +0100
changeset 144
202ad178f68f
parent 142
6faac5ee8017
child 145
66ea6b61242e
child 146
11e6db4102f1
permissions
-rwxr-xr-x

Fix matomo and CATEGORY_FEED_ATOM config option

#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import socket

isprod = socket.gethostname() == 'sd-56079'

AUTHOR = u'David Douard'
SITENAME = u'Whatever'
SITESUBTITLE = u"A blog, sort of"
TWITTER_USERNAME = u'douardda'
CONTACTS = (('twitter', 'https://twitter.com/douardda'),
            ('mastodon', 'https://pouet.chapril.org/@douardda'))


if isprod:
    SITEURL = 'https://whatever.sdfa3.org'
    PIWIK = '''
<!-- Matomo -->
<script type="text/javascript">
  var _paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="https://piwik.sdfa3.org/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '2']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Code -->
    '''
else:
    SITEURL = ''
    PIWIK = ''

PATH = 'content'

THEME = 'theme'
TIMEZONE = 'Europe/Paris'

DEFAULT_LANG = u'en'

# Feed generation is usually not desired when developing
#FEED_ALL_ATOM = None
#CATEGORY_FEED_ATOM = None
CATEGORY_FEED_ATOM_URL = 'feeds/%s.atom.xml'
#TRANSLATION_FEED_ATOM = None
#AUTHOR_FEED_ATOM = None
#AUTHOR_FEED_RSS = None

FEED_RSS = 'feeds/rss.xml'
FEED_ALL_RSS = 'feeds/all.rss.xml'
FEED_ATOM = 'feeds/atom.xml'
FEED_ALL_ATOM = 'feeds/all.atom.xml'

# Blogroll
LINKS = (('Pelican', 'http://getpelican.com/'),
         ('EEVBlog', 'https://www.eevblog.com/'),
         )

# Social widget
SOCIAL = (('twitter', 'https://twitter.com/douardda'),
          ('mastodon', 'https://social.logilab.org/@david'))


DEFAULT_PAGINATION = 10

# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True

STATIC_PATHS = ['images', 'pdfs', 'json', 'data']

PLUGIN_PATHS = ['local-plugins/pelican-peertube',
                'local-plugins',
                'pelican-plugins',
                ]
PLUGINS = ['better_figures_and_images',
           'sitemap',
           #'feed_summary',
           # 'assets',
           'series',
           'related_posts',
           'filetime_from_hg',
           'pelican_peertube',
           'pelican_javascript',
           'wavedrom',
           'plotly',
           # 'image_process',  # seems broken with pelican 4
           ]
RESPONSIVE_IMAGES = True
TYPOGRIPFY = True
SINGLE_AUTHOR = True
MINT = True
SITEMAP = {'format': 'xml'}

IMAGE_PROCESS = {
  'crisp': {'type': 'responsive-image',
            'srcset': [('1x', ['scale_in 800 600 True']),
                       ('2x', ['scale_in 1600 1200 True']),
                       ('3x', ['scale_in 3200 2400 True']),
                       ],
            'default': '1x',
            },
  'large-photo': {'type': 'responsive-image',
                  'sizes': '(min-width: 1200px) 800px, (min-width: 992px) 650px, \
                            (min-width: 768px) 718px, 100vw',
                  'srcset': [('600w', ["scale_in 600 450 True"]),
                             ('800w', ["scale_in 800 600 True"]),
                             ('1600w', ["scale_in 1600 1200 True"]),
                             ],
                  'default': '800w',
                  },
  }

PEERTUBE_URL = "https://peertube.social"

mercurial