Skip to content
Permalink
Browse files
fix #1168
  • Loading branch information
ralsina committed Jun 13, 2015
1 parent afe5b36 commit 7233a4c164389cf847ef3a8e6ce3ae578019bf5f
Showing with 13 additions and 0 deletions.
  1. +5 −0 CHANGES.txt
  2. +8 −0 nikola/plugins/command/import_wordpress.py
@@ -1,6 +1,11 @@
New in Master
=============

Features
--------

* Add redirection for tags in Wordpress importer (Issue #1168)

Bugfixes
--------

@@ -101,6 +101,7 @@ class CommandImportWordpress(Command, ImportMixin):
'help': "The pattern for translation files names",
},
]
all_tags = set([])

def _execute(self, options={}, args=[]):
"""Import a WordPress blog from an export file into a Nikola site."""
@@ -165,6 +166,12 @@ def show_info_about_mising_module(modulename):
self.extra_languages)
self.context['REDIRECTIONS'] = self.configure_redirections(
self.url_map)

# Add tag redirects
for tag in self.all_tags:
tag = utils.slugify(tag.decode('utf8'))
self.url_map['{}tag/{}'.format(self.context['SITE_URL'], tag)] = self.context['SITE_URL'] + 'categories/' + tag + '.html'

self.write_urlmap_csv(
os.path.join(self.output_folder, 'url_map.csv'), self.url_map)
rendered_template = conf_template.render(**prepare_config(self.context))
@@ -445,6 +452,7 @@ def import_item(self, item, wordpress_namespace, out_folder=None):
if text == 'Uncategorized':
continue
tags.append(text)
self.all_tags.add(text)

if '$latex' in content:
tags.append('mathjax')

0 comments on commit 7233a4c

Please sign in to comment.