You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
175 lines
4.6 KiB
175 lines
4.6 KiB
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*- #
|
|
|
|
# Probably replace those with simpler methods:
|
|
from __future__ import unicode_literals
|
|
from operator import itemgetter, methodcaller
|
|
|
|
AUTHOR = 'Philipp Schönberger'
|
|
EMAIL = 'mail AT phschoen.de'
|
|
SITENAME = 'https://phschoen.de'
|
|
OUTPUT_PATH = 'output/DEV/'
|
|
|
|
# Base URL this page is hosted at:
|
|
SITENAME = 'phschoen.de'
|
|
# SITEURL = 'http://skylx125.ndsatcom.com:8000'
|
|
SITEURL = 'http://localhost:8000'
|
|
|
|
# Timezone is GMT+1:
|
|
TIMEZONE = 'Europe/Paris'
|
|
# Using a simple date format:
|
|
DEFAULT_DATE_FORMAT = ('%d %b %Y')
|
|
DEFAULT_LANG = 'en'
|
|
DATE_FORMATS = {
|
|
'en': '%-d/%b/%Y',
|
|
'de': '%-d/%-m/%Y',
|
|
}
|
|
LOCALE = ('usa', 'de', # On Windows
|
|
'en_US', 'de_DE' # On Unix/Linux
|
|
)
|
|
|
|
# We are using the custom minimal theme:
|
|
THEME = 'themes/minimal'
|
|
# THEME = 'themes/pelican-chunk'
|
|
#THEME = 'themes/pelican-themes/bootstrap4-standard'
|
|
|
|
DELETE_OUTPUT_DIRECTORY = True
|
|
# MARKUP = ('md',)
|
|
# # Markdown Configuration:
|
|
# MARKDOWN = {
|
|
# 'extension_configs': {
|
|
# 'markdown.extensions.codehilite': {'css_class': 'highlight'},
|
|
# 'markdown.extensions.toc' : {},
|
|
# 'markdown.extensions.extra': {},
|
|
# 'markdown.extensions.meta': {},
|
|
# },
|
|
# 'output_format': 'html5',
|
|
# }
|
|
# We don't use relative URLs:
|
|
RELATIVE_URLS = False
|
|
|
|
# Edit predefined pathes:
|
|
ARCHIVES_SAVE_AS = 'pages/index.html'
|
|
|
|
# Generates nice URLs for pages:
|
|
PAGE_URL = '{slug}'
|
|
PAGE_SAVE_AS = '{slug}/index.html'
|
|
|
|
# Generate nice URLs for articles:
|
|
ARTICLE_EXCLUDES = (('pages',))
|
|
ARTICLE_URL = 'blog/{slug}'
|
|
ARTICLE_SAVE_AS = 'blog/{slug}/index.html'
|
|
|
|
# Generate nice URLs for tags:
|
|
TAG_URL = 'tag/{name}/'
|
|
TAG_SAVE_AS = 'tag/{name}/index.html'
|
|
TAGS_SAVE_AS = 'tags/index.html'
|
|
|
|
# Generate nice URLs for categories:
|
|
CATEGORY_URL = 'category/{name}/'
|
|
CATEGORY_SAVE_AS = 'category/{name}/index.html'
|
|
|
|
# Setup the RSS/ATOM feeds:
|
|
FEED_DOMAIN = SITEURL
|
|
FEED_MAX_ITEMS = 10
|
|
# We only want RSS/ATOM Feeds for all articles, exclude categories:
|
|
FEED_RSS = 'feeds/rss.xml'
|
|
TAG_FEED_RSS = 'feeds/{slug}.rss.xml'
|
|
CATEGORY_FEED_RSS = None
|
|
|
|
# Feed generation is usually not desired when developing
|
|
FEED_ATOM = 'feeds/atom.xml'
|
|
FEED_ALL_ATOM = None
|
|
TAG_FEED_ATOM = None
|
|
CATEGORY_FEED_ATOM = None
|
|
TRANSLATION_FEED_ATOM = None
|
|
|
|
|
|
# Separate page directory and articles directory:
|
|
PAGE_PATHS = ['pages']
|
|
ARTICLE_PATHS = ['blog']
|
|
|
|
# Save index as blog/index.html instead of index.html:
|
|
INDEX_SAVE_AS = 'blog/index.html'
|
|
|
|
# Navigation menu:
|
|
SECTIONS = [('blog', '/blog'),
|
|
('Projects', '/projects'),
|
|
('Gallery', '/gallery'),
|
|
('about', '/about'),
|
|
('Impressum', '/impressum'),
|
|
]
|
|
|
|
# Links to display in the footer:
|
|
LINKS = [('bsd', 'http://www.opensource.org/licenses/BSD-3-Clause'),
|
|
('xhtml', 'http://validator.w3.org/check/referer'),
|
|
('css3', 'http://jigsaw.w3.org/css-validator/check/referer?profile=css'),
|
|
('pelican', 'https://github.com/getpelican'),
|
|
]
|
|
|
|
# Set some default category:
|
|
DEFAULT_CATEGORY = 'uncategorized'
|
|
|
|
# Social widget
|
|
# SOCIAL = (('You can add links in your config file', '#'),
|
|
# ('Another social link', '#'),)
|
|
|
|
# DEFAULT_PAGINATION = 10
|
|
|
|
PLUGIN_PATHS = ['plugins', ]
|
|
PLUGINS = ['lightgallery', 'i18n_subsites']
|
|
# PLUGIN_PATHS = ['./pelican-plugins/', ]
|
|
|
|
# PLUGINS = ['i18n_subsites', ]
|
|
# JINJA_ENVIRONMENT = {
|
|
# 'extensions': ['jinja2.ext.i18n'],
|
|
# }
|
|
|
|
|
|
GITHUB_SOURCE_PATH = "wooot"
|
|
|
|
I18N_SUBSITES = {'en': {'SITENAME': 'phschoen.com',
|
|
},
|
|
'de': {'SITENAME': 'phschoen.de',
|
|
},
|
|
}
|
|
|
|
languages_lookup = {'en': 'English',
|
|
'de': 'Deutsch',
|
|
}
|
|
|
|
|
|
def lookup_lang_name(lang_code):
|
|
return languages_lookup[lang_code]
|
|
|
|
|
|
def getGitHubPage(source_file):
|
|
filename = getBasename(source_file)
|
|
return '{0}/{1}'.format(GITHUB_SOURCE_PATH, filename)
|
|
|
|
|
|
def getBasename(path):
|
|
return "name "
|
|
|
|
|
|
def month_name(month_number):
|
|
return "month_name"
|
|
|
|
|
|
def sortTupleByIndex(items, index=0, reverse=True):
|
|
return sorted(items, key=lambda tup: len(tup[index]), reverse=reverse)
|
|
|
|
|
|
def sortDictByKey(items, key, reverse=True, default=None):
|
|
if default is None:
|
|
return sorted(items, key=itemgetter(key), reverse=reverse)
|
|
return sorted(items, key=methodcaller('get', key, default), reverse=reverse)
|
|
|
|
|
|
JINJA_FILTERS = {'month_name': month_name,
|
|
'sortTupleByIndex': sortTupleByIndex,
|
|
'sortDictByKey': sortDictByKey,
|
|
'basename': getBasename,
|
|
'asGitHubPage': getGitHubPage,
|
|
'lookup_lang_name': lookup_lang_name,
|
|
}
|