Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
USE_BASE_TAG flag
  • Loading branch information
ralsina committed Sep 1, 2015
1 parent a970c13 commit 4edd6e0
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,7 @@ New in master
Features
--------

* Make <base> tag optional with USE_BASE_TAG flag (Issue #1985)
* Render author pages (Issue #1972)
* Atom feeds for tag lists (Issue #1686)
* New ``THEME_COLOR`` option for customizing themes from a primary color
Expand Down
64 changes: 36 additions & 28 deletions nikola/conf.py.in
Expand Up @@ -93,6 +93,35 @@ THEME = ${THEME}
# auto-generate related colors in POSTS_SECTION_COLORS. Must be a HEX value.
THEME_COLOR = '#5670d4'

# POSTS and PAGES contains (wildcard, destination, template) tuples.
#
# The wildcard is used to generate a list of reSt source files
# (whatever/thing.txt).
#
# That fragment could have an associated metadata file (whatever/thing.meta),
# and optionally translated files (example for Spanish, with code "es"):
# whatever/thing.es.txt and whatever/thing.es.meta
#
# This assumes you use the default TRANSLATIONS_PATTERN.
#
# From those files, a set of HTML fragment files will be generated:
# cache/whatever/thing.html (and maybe cache/whatever/thing.html.es)
#
# These files are combined with the template to produce rendered
# pages, which will be placed at
# output / TRANSLATIONS[lang] / destination / pagename.html
#
# where "pagename" is the "slug" specified in the metadata file.
#
# The difference between POSTS and PAGES is that POSTS are added
# to feeds and are considered part of a blog, while PAGES are
# just independent HTML pages.
#

POSTS = ${POSTS}
PAGES = ${PAGES}


##############################################
# Below this point, everything is optional
##############################################
Expand Down Expand Up @@ -139,34 +168,6 @@ TIMEZONE = ${TIMEZONE}
# LOCALE_DEFAULT = locale to use for languages not mentioned in LOCALES; if
# not set the default Nikola mapping is used.

# POSTS and PAGES contains (wildcard, destination, template) tuples.
#
# The wildcard is used to generate a list of reSt source files
# (whatever/thing.txt).
#
# That fragment could have an associated metadata file (whatever/thing.meta),
# and optionally translated files (example for Spanish, with code "es"):
# whatever/thing.es.txt and whatever/thing.es.meta
#
# This assumes you use the default TRANSLATIONS_PATTERN.
#
# From those files, a set of HTML fragment files will be generated:
# cache/whatever/thing.html (and maybe cache/whatever/thing.html.es)
#
# These files are combined with the template to produce rendered
# pages, which will be placed at
# output / TRANSLATIONS[lang] / destination / pagename.html
#
# where "pagename" is the "slug" specified in the metadata file.
#
# The difference between POSTS and PAGES is that POSTS are added
# to feeds and are considered part of a blog, while PAGES are
# just independent HTML pages.
#

POSTS = ${POSTS}
PAGES = ${PAGES}

# One or more folders containing files to be copied as-is into the output.
# The format is a dictionary of {source: relative destination}.
# Default is:
Expand Down Expand Up @@ -411,6 +412,13 @@ HIDDEN_AUTHORS = ['Guest']
# absolute: a complete URL (that includes the SITE_URL)
# URL_TYPE = 'rel_path'

# If USE_BASE_TAG is True, then all HTML files will include
# something like <base href=http://foo.var.com/baz/bat> to help
# the browser resolve relative links.
# In some rare cases, this will be a problem, and you can
# disable it by setting USE_BASE_TAG to False.
# USE_BASE_TAG = True

# Final location for the blog main RSS feed is:
# output / TRANSLATION[lang] / RSS_PATH / rss.xml
# RSS_PATH = ""
Expand Down
2 changes: 2 additions & 0 deletions nikola/data/themes/base/templates/base_helper.tmpl
Expand Up @@ -21,7 +21,9 @@ dir="rtl" \
lang="${lang}">
<head>
<meta charset="utf-8">
% if use_base_tag:
<base href="${abs_link(permalink)}">
% endif
%if description:
<meta name="description" content="${description}">
%endif
Expand Down
2 changes: 2 additions & 0 deletions nikola/data/themes/bootstrap3/templates/base_helper.tmpl
Expand Up @@ -26,7 +26,9 @@ dir="rtl" \
lang="${lang}">
<head>
<meta charset="utf-8">
% if use_base_tag:
<base href="${abs_link(permalink)}">
% endif
%if description:
<meta name="description" content="${description}">
%endif
Expand Down
2 changes: 2 additions & 0 deletions nikola/nikola.py
Expand Up @@ -486,6 +486,7 @@ def __init__(self, **config):
'THUMBNAIL_SIZE': 180,
'UNSLUGIFY_TITLES': False, # WARNING: conf.py.in overrides this with True for backwards compatibility
'URL_TYPE': 'rel_path',
'USE_BASE_TAG': True,
'USE_BUNDLES': True,
'USE_CDN': False,
'USE_CDN_WARNING': True,
Expand Down Expand Up @@ -869,6 +870,7 @@ def _set_global_context(self):
self._GLOBAL_CONTEXT['index_display_post_count'] = self.config[
'INDEX_DISPLAY_POST_COUNT']
self._GLOBAL_CONTEXT['index_file'] = self.config['INDEX_FILE']
self._GLOBAL_CONTEXT['use_base_tag'] = self.config['USE_BASE_TAG']
self._GLOBAL_CONTEXT['use_bundles'] = self.config['USE_BUNDLES']
self._GLOBAL_CONTEXT['use_cdn'] = self.config.get("USE_CDN")
self._GLOBAL_CONTEXT['theme_color'] = self.config.get("THEME_COLOR")
Expand Down

0 comments on commit 4edd6e0

Please sign in to comment.