Repository: getnikola/nikola

Issue:
ATOM_PATH
We have `RSS_PATH` but no `ATOM_PATH`.

I would like to have consistent URLs for RSS and ATOM Feeds.

Current:
RSS: https://davidak.de/rss.xml
ATOM: https://davidak.de/blog/index.atom

What i want:
RSS: https://davidak.de/rss.xml
ATOM: https://davidak.de/index.atom

(I'm not sure how important this is and if anyone uses ATOM Feeds nowadays)


Discussion:
Probably not very important, but also probably easy to do :-)

Resolving patch:
diff --git a/nikola/nikola.py b/nikola/nikola.py
--- a/nikola/nikola.py
+++ b/nikola/nikola.py
@@ -539,6 +539,7 @@ def __init__(self, **config):
             'ROBOTS_EXCLUSIONS': [],
             'GENERATE_ATOM': False,
             'ATOM_EXTENSION': '.atom',
+            'ATOM_PATH': '',
             'FEED_TEASERS': True,
             'FEED_PLAIN': False,
             'FEED_PREVIEWIMAGE': True,
@@ -618,6 +619,9 @@ def __init__(self, **config):
         self.config['__invariant__'] = self.invariant
         self.config['__quiet__'] = self.quiet
 
+        # Use ATOM_PATH when set
+        self.config['ATOM_PATH'] = self.config['ATOM_PATH'] or self.config['INDEX_PATH']
+
         # Make sure we have sane NAVIGATION_LINKS.
         if not self.config['NAVIGATION_LINKS']:
             self.config['NAVIGATION_LINKS'] = {self.config['DEFAULT_LANG']: ()}
@@ -658,6 +662,7 @@ def __init__(self, **config):
                                       'CATEGORIES_INDEX_PATH',
                                       'SECTION_PATH',
                                       'INDEX_PATH',
+                                      'ATOM_PATH',
                                       'RSS_PATH',
                                       'RSS_FILENAME_BASE',
                                       'AUTHOR_PATH',
@@ -687,7 +692,8 @@ def __init__(self, **config):
                                              'front_index_header',
                                              )
 
-        self._ALL_PAGE_DEPS_TRANSLATABLE = ('rss_path',
+        self._ALL_PAGE_DEPS_TRANSLATABLE = ('atom_path',
+                                            'rss_path',
                                             'rss_filename_base',
                                             )
         # WARNING: navigation_links SHOULD NOT be added to the list above.
@@ -1178,6 +1184,7 @@ def _set_all_page_deps_from_config(self):
         Unlike global context, contents are NOT available to templates.
         """
         self.ALL_PAGE_DEPS['atom_extension'] = self.config.get('ATOM_EXTENSION')
+        self.ALL_PAGE_DEPS['atom_path'] = self.config.get('ATOM_PATH')
         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')
diff --git a/nikola/plugins/task/indexes.py b/nikola/plugins/task/indexes.py
--- a/nikola/plugins/task/indexes.py
+++ b/nikola/plugins/task/indexes.py
@@ -95,7 +95,8 @@ def get_path(self, classification, lang, dest_type='page'):
                 self.site.config['RSS_PATH'](lang),
                 self.site.config['RSS_FILENAME_BASE'](lang)
             ], 'auto'
-        # 'page' (index) or 'feed' (Atom)
+        if dest_type == 'feed':
+            return [self.site.config['ATOM_PATH'](lang)], 'always'
         page_number = None
         if dest_type == 'page':
             # Interpret argument as page number


Test patch:
diff --git a/tests/data/translated_titles/conf.py b/tests/data/translated_titles/conf.py
--- a/tests/data/translated_titles/conf.py
+++ b/tests/data/translated_titles/conf.py
@@ -225,6 +225,10 @@
 # output / TRANSLATION[lang] / RSS_PATH / rss.xml
 # RSS_PATH = ""
 
+# Final location for the blog main Atom feed is:
+# output / TRANSLATION[lang] / ATOM_PATH / index.atom
+# ATOM_PATH = ""
+
 # Number of posts in RSS feeds
 # FEED_LENGTH = 10