Skip to content
Permalink
Browse files
Add ATOM_FILENAME_BASE, use feed.atom instead of index.atom for new s…
…ites

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed May 1, 2018
1 parent c55f840 commit eceddddb92d3ff2f0c185506ad0443dde2245940
@@ -16,6 +16,8 @@ Important compatibility changes
Features
--------

* Add ``ATOM_FILENAME_BASE`` setting (defaults to ``index`` for
existing sites, but ``feed`` for new sites) (Issue #3016)
* Produce a better error message when a template referenced in another
template is missing (Issue #3055)
* Support captioned images and image ordering in galleries (Issue #3017)
@@ -528,10 +528,17 @@ USE_BASE_TAG = False
# RSS_PATH = ""

# Final location for the blog main Atom feed is:
# output / TRANSLATION[lang] / ATOM_PATH / index.atom
# output / TRANSLATION[lang] / ATOM_PATH / ATOM_FILENAME_BASE ATOM_EXTENSION
# (translatable)
# ATOM_PATH = ""

# Atom filename base (without extension); used for indexes.
# (translatable)
ATOM_FILENAME_BASE = "feed"

# Extension for Atom feed files
# ATOM_EXTENSION = ".atom"

# Slug the Tag URL. Easier for users to type, special characters are
# often removed or replaced as well.
# SLUG_TAG_PATH = True
@@ -1071,9 +1078,6 @@ MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code', 'markdown.extensions.c
# between each other. Old Atom feeds with no changes are marked as archived.
# GENERATE_ATOM = False

# Extension for Atom feed files
# ATOM_EXTENSION = ".atom"

# Only include teasers in Atom and RSS feeds. Disabling include the full
# content. Defaults to True.
# FEED_TEASERS = True
@@ -540,6 +540,7 @@ def __init__(self, **config):
'GENERATE_ATOM': False,
'ATOM_EXTENSION': '.atom',
'ATOM_PATH': '',
'ATOM_FILENAME_BASE': 'index',
'FEED_TEASERS': True,
'FEED_PLAIN': False,
'FEED_PREVIEWIMAGE': True,
@@ -665,6 +666,7 @@ def __init__(self, **config):
'ATOM_PATH',
'RSS_PATH',
'RSS_FILENAME_BASE',
'ATOM_FILENAME_BASE',
'AUTHOR_PATH',
'DATE_FORMAT',
'JS_DATE_FORMAT',
@@ -695,6 +697,7 @@ def __init__(self, **config):
self._ALL_PAGE_DEPS_TRANSLATABLE = ('atom_path',
'rss_path',
'rss_filename_base',
'atom_filename_base',
)
# WARNING: navigation_links SHOULD NOT be added to the list above.
# Themes ask for [lang] there and we should provide it.
@@ -1196,6 +1199,7 @@ def _set_all_page_deps_from_config(self):
self.ALL_PAGE_DEPS['rss_extension'] = self.config.get('RSS_EXTENSION')
self.ALL_PAGE_DEPS['rss_path'] = self.config.get('RSS_PATH')
self.ALL_PAGE_DEPS['rss_filename_base'] = self.config.get('RSS_FILENAME_BASE')
self.ALL_PAGE_DEPS['atom_filename_base'] = self.config.get('ATOM_FILENAME_BASE')
self.ALL_PAGE_DEPS['slug_author_path'] = self.config.get('SLUG_AUTHOR_PATH')
self.ALL_PAGE_DEPS['slug_tag_path'] = self.config.get('SLUG_TAG_PATH')

@@ -241,6 +241,8 @@ def _postprocess_path(self, path, lang, append_index='auto', dest_type='page', p
if force_extension is not None:
if len(path) == 0 and dest_type == 'rss':
path = [self.site.config['RSS_FILENAME_BASE'](lang)]
elif len(path) == 0 and dest_type == 'feed':
path = [self.site.config['ATOM_FILENAME_BASE'](lang)]
elif len(path) == 0 or append_index == 'always':
path = path + [os.path.splitext(self.site.config['INDEX_FILE'])[0]]
elif len(path) > 0 and append_index == 'never':
@@ -96,7 +96,10 @@ def get_path(self, classification, lang, dest_type='page'):
self.site.config['RSS_FILENAME_BASE'](lang)
], 'auto'
if dest_type == 'feed':
return [self.site.config['ATOM_PATH'](lang)], 'always'
return [
self.site.config['ATOM_PATH'](lang),
self.site.config['ATOM_FILENAME_BASE'](lang)
], 'auto'
page_number = None
if dest_type == 'page':
# Interpret argument as page number
@@ -101,6 +101,8 @@ def get_path(self, section, lang, dest_type='page'):
result = [_f for _f in [self.site.config['SECTION_PATH'](lang), section] if _f]
if dest_type == 'rss':
return result + [self.site.config['RSS_FILENAME_BASE'](lang)], 'auto'
elif dest_type == 'feed':
return result + [self.site.config['ATOM_FILENAME_BASE'](lang)], 'auto'
return result, 'always'

def provide_context_and_uptodate(self, classification, lang, node=None):

0 comments on commit ecedddd

Please sign in to comment.