Skip to content
Snippets Groups Projects
Commit 80166a31 authored by OndraRehounek's avatar OndraRehounek
Browse files

district & region: Tags in import

parent c622030a
No related branches found
No related tags found
2 merge requests!468Release,!459district & region: fancybox galleries
Pipeline #7658 passed
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</div> </div>
<div class="my-4"> <div class="my-4">
{% for tag in page.tags.all %} {% for tag in page.tags.all %}
<a href="{{ page.root_page.tags_page.url }}#{{ tag }}" class="btn btn--grey-125 btn--condensed"> <a href="{{ page.root_page.tags_page.url }}?tag={{ tag.slug }}" class="btn btn--grey-125 btn--condensed">
<div class="btn__body ">{{ tag }}</div> <div class="btn__body ">{{ tag }}</div>
</a> </a>
{% endfor %} {% endfor %}
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</div> </div>
<div class="my-4"> <div class="my-4">
{% for tag in page.tags.all %} {% for tag in page.tags.all %}
<a href="{{ page.root_page.tags_page.url }}#{{ tag }}" class="btn btn--grey-125 btn--condensed"> <a href="{{ page.root_page.tags_page.url }}?tag={{ tag.slug }}" class="btn btn--grey-125 btn--condensed">
<div class="btn__body ">{{ tag }}</div> <div class="btn__body ">{{ tag }}</div>
</a> </a>
{% endfor %} {% endfor %}
......
...@@ -499,6 +499,11 @@ class JekyllArticleImporter: ...@@ -499,6 +499,11 @@ class JekyllArticleImporter:
meta_dict.update({key: value}) meta_dict.update({key: value})
return meta_dict return meta_dict
@staticmethod
def handle_tags(article, meta):
for tag_name in meta.get("tags", []):
article.tags.add(tag_name)
def import_post(self, file_path): def import_post(self, file_path):
with open(os.path.join(self.path, file_path), "rt") as f: with open(os.path.join(self.path, file_path), "rt") as f:
...@@ -556,9 +561,6 @@ class JekyllArticleImporter: ...@@ -556,9 +561,6 @@ class JekyllArticleImporter:
article.seo_title = article.title + self.title_suffix article.seo_title = article.title + self.title_suffix
article.search_description = meta.get("description", "") article.search_description = meta.get("description", "")
# for tag in meta['tags']:
# article.tags.add(tag)
if meta.get("image", None): if meta.get("image", None):
article.image, log_message = get_or_create_image( article.image, log_message = get_or_create_image(
self.path, meta["image"], self.collection, self.repo_name self.path, meta["image"], self.collection, self.repo_name
...@@ -586,6 +588,8 @@ class JekyllArticleImporter: ...@@ -586,6 +588,8 @@ class JekyllArticleImporter:
self.skipped_counter += 1 self.skipped_counter += 1
return article return article
self.handle_tags(article, meta)
self.success_counter += 1 self.success_counter += 1
return article return article
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment