Skip to content

Commit

Permalink
Fix #2420 -- use new_post path for meta files, too
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Aug 1, 2016
1 parent 7ace85e commit 6363199
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -11,6 +11,8 @@ Features
Bugfixes
--------

* Put 2-file post metadata in the same place as the text file when
specifying a path in ``new_post``, ``new_page`` (Issue #2420)
* Register dependencies in post-list shortcode (Issue #2412)
* Support post-list shortcode better (Issue #2408)
* Fix gallery links in base theme (Issue #2416)
Expand Down
11 changes: 7 additions & 4 deletions nikola/plugins/command/new_post.py
Expand Up @@ -325,14 +325,17 @@ def _execute(self, options, args):
'description': '',
'type': 'text',
}
output_path = os.path.dirname(entry[0])
meta_path = os.path.join(output_path, slug + ".meta")
pattern = os.path.basename(entry[0])
suffix = pattern[1:]

if not path:
pattern = os.path.basename(entry[0])
suffix = pattern[1:]
output_path = os.path.dirname(entry[0])

txt_path = os.path.join(output_path, slug + suffix)
meta_path = os.path.join(output_path, slug + ".meta")
else:
txt_path = os.path.join(self.site.original_cwd, path)
meta_path = os.path.splitext(txt_path)[0] + ".meta"

if (not onefile and os.path.isfile(meta_path)) or \
os.path.isfile(txt_path):
Expand Down

0 comments on commit 6363199

Please sign in to comment.