2016-05-13 21:13:23 +01:00
|
|
|
# -*- coding: utf-8 -*- #
|
|
|
|
from __future__ import unicode_literals
|
2016-07-29 23:07:55 +01:00
|
|
|
from git import Repo
|
2016-05-21 20:35:59 +01:00
|
|
|
import sys, os
|
2016-09-08 21:24:39 +01:00
|
|
|
sys.path.insert(0, os.path.realpath('./'))
|
2016-05-21 20:35:59 +01:00
|
|
|
|
2016-09-08 21:50:22 +01:00
|
|
|
from config import settings
|
|
|
|
|
2016-05-28 22:59:58 +01:00
|
|
|
# Global core settings
|
2016-09-08 22:14:42 +01:00
|
|
|
AUTHOR = settings.author
|
|
|
|
SITENAME = settings.site_name
|
|
|
|
SITEURL = settings.url
|
2017-01-09 22:14:38 +00:00
|
|
|
PATH = 'content'
|
2016-09-08 22:14:42 +01:00
|
|
|
TIMEZONE = settings.timezone
|
|
|
|
DEFAULT_LANG = settings.language
|
2016-05-28 22:59:58 +01:00
|
|
|
PAGE_PATHS = ["pages"]
|
2017-01-09 22:14:38 +00:00
|
|
|
THEME = "theme"
|
2016-05-28 22:59:58 +01:00
|
|
|
THEME_STATIC_DIR = "static"
|
2016-06-11 12:53:23 +01:00
|
|
|
THEME_STATIC_PATHS = ["static/build"]
|
|
|
|
STATIC_PATHS = ["assets"]
|
|
|
|
|
2016-05-28 22:59:58 +01:00
|
|
|
USE_FOLDER_AS_CATEGORY = True
|
|
|
|
DEFAULT_PAGINATION = False
|
|
|
|
SLUGIFY_SOURCE = 'basename'
|
2016-05-13 21:13:23 +01:00
|
|
|
|
|
|
|
# Social widget
|
2016-09-08 21:24:39 +01:00
|
|
|
from plugins import links
|
2016-06-17 17:26:45 +01:00
|
|
|
ACCOUNTS = links.accounts()
|
2016-06-17 17:17:05 +01:00
|
|
|
FOOTER_LINKS = links.footer()
|
2016-05-29 23:23:55 +01:00
|
|
|
INDEX_PROJECTS = links.index_projects()
|
2016-08-16 22:23:02 +01:00
|
|
|
|
|
|
|
# Extra config
|
2016-07-29 23:07:55 +01:00
|
|
|
REPO = Repo(search_parent_directories=True)
|
2016-08-16 22:23:02 +01:00
|
|
|
BUILD_PRODUCTION = 'BUILD_PRODUCTION' in os.environ
|
2016-09-08 21:24:39 +01:00
|
|
|
from plugins import image_resizer
|
2016-08-26 11:41:35 +01:00
|
|
|
META_IMAGES = image_resizer.generate()
|
2016-10-07 22:02:09 +01:00
|
|
|
PIWIK = settings.piwik
|
2016-05-21 20:35:59 +01:00
|
|
|
|
2016-05-28 22:59:58 +01:00
|
|
|
# Disable some pages
|
|
|
|
TAG_URL = False
|
|
|
|
TAG_SAVE_AS = False
|
|
|
|
TAGS_SAVE_AS = False
|
|
|
|
AUTHORS_URL = False
|
|
|
|
AUTHORS_SAVE_AS = False
|
|
|
|
CATEGORIES_SAVE_AS = False
|
|
|
|
ARCHIVES_URL = False
|
|
|
|
ARCHIVES_SAVE_AS = False
|
2016-07-29 12:00:06 +01:00
|
|
|
AUTHOR_URL = False
|
|
|
|
AUTHOR_SAVE_AS = False
|
2016-05-13 21:13:23 +01:00
|
|
|
|
2016-05-28 22:59:58 +01:00
|
|
|
# Override page URLs
|
2016-05-13 21:37:54 +01:00
|
|
|
PAGE_SAVE_AS = "{slug}/index.html"
|
2016-10-02 11:36:21 +01:00
|
|
|
PAGE_URL = "{slug}/"
|
2016-05-27 15:16:13 +01:00
|
|
|
ARTICLE_SAVE_AS = "{category}/{slug}/index.html"
|
|
|
|
ARTICLE_URL = "{category}/{slug}/"
|
|
|
|
CATEGORY_SAVE_AS = "{slug}/index.html"
|
2016-05-27 23:19:03 +01:00
|
|
|
CATEGORY_URL = "{slug}/"
|
|
|
|
|
2016-05-28 22:59:58 +01:00
|
|
|
# Add ATOM feed
|
2016-05-28 22:53:30 +01:00
|
|
|
FEED_ATOM = 'feed.atom'
|
|
|
|
FEED_DOMAIN = SITEURL
|
|
|
|
|
2016-05-28 22:59:58 +01:00
|
|
|
# Setup plugins
|
2017-01-09 22:14:38 +00:00
|
|
|
PLUGIN_PATHS = ["plugins", "pelican_plugins"]
|
2016-09-08 22:14:42 +01:00
|
|
|
PLUGINS = settings.pelican_plugins
|
2016-05-17 18:32:23 +01:00
|
|
|
|
2016-08-16 22:23:02 +01:00
|
|
|
if BUILD_PRODUCTION:
|
2016-07-29 21:55:19 +01:00
|
|
|
PLUGINS.append("minify") # only minify on production build
|
|
|
|
|
2016-05-17 18:32:23 +01:00
|
|
|
SITEMAP = {
|
2016-09-08 22:14:42 +01:00
|
|
|
"format": settings.sitemap_format
|
2016-05-17 18:32:23 +01:00
|
|
|
}
|
2016-06-26 11:57:22 +01:00
|
|
|
CATEGORY_PAGE_PATH = "theme/templates/categories"
|
2016-09-09 15:08:30 +01:00
|
|
|
MINIFY = {
|
|
|
|
'remove_comments': True,
|
|
|
|
'remove_optional_attribute_quotes': False,
|
|
|
|
'reduce_boolean_attributes': True,
|
|
|
|
}
|
2016-06-26 11:57:22 +01:00
|
|
|
|
2016-05-28 22:59:58 +01:00
|
|
|
# Setup markdown extensions
|
2016-05-28 22:26:36 +01:00
|
|
|
from fontawesome_markdown import FontAwesomeExtension
|
2016-06-25 15:22:54 +01:00
|
|
|
from pyembed.markdown import PyEmbedMarkdown
|
2016-06-30 14:29:07 +01:00
|
|
|
from mkdcomments import CommentsExtension
|
2017-01-13 08:55:25 +00:00
|
|
|
MARKDOWN = {
|
|
|
|
'extensions': [
|
|
|
|
FontAwesomeExtension(),
|
|
|
|
PyEmbedMarkdown(),
|
|
|
|
CommentsExtension(),
|
|
|
|
'codehilite(css_class=highlight)',
|
|
|
|
'extra'
|
|
|
|
]
|
|
|
|
}
|
2016-05-28 22:59:58 +01:00
|
|
|
# Setup jinja2 filters
|
2016-09-08 21:24:39 +01:00
|
|
|
from plugins import filters
|
2016-05-27 15:42:29 +01:00
|
|
|
JINJA_FILTERS = {
|
2016-05-27 23:19:03 +01:00
|
|
|
"datetime": filters.format_datetime,
|
2016-06-03 22:12:34 +01:00
|
|
|
"category_find": filters.category_find,
|
2016-08-27 22:24:09 +01:00
|
|
|
"limit": filters.limit
|
2016-05-27 15:42:29 +01:00
|
|
|
}
|
2017-01-13 08:55:25 +00:00
|
|
|
|
|
|
|
JINJA_ENVIRONMENT = {
|
|
|
|
'trim_blocks': True,
|
|
|
|
'lstrip_blocks': True,
|
|
|
|
'extensions': {}
|
|
|
|
}
|