From 22bf2e8e2aaa43bb9a2794d94f74e8b38b1a72fa Mon Sep 17 00:00:00 2001 From: Janis Lesinskis Date: Sun, 18 Aug 2019 22:26:33 -0400 Subject: [PATCH 1/3] Start making a tag summary page --- pages/tags/hello.md | 5 +++++ plugins.py | 6 ++++++ templates/tag_summary.html | 8 ++++++++ 3 files changed, 19 insertions(+) create mode 100644 pages/tags/hello.md create mode 100644 templates/tag_summary.html diff --git a/pages/tags/hello.md b/pages/tags/hello.md new file mode 100644 index 0000000..6db7fab --- /dev/null +++ b/pages/tags/hello.md @@ -0,0 +1,5 @@ +--- +ShortSummary: "Hello is an example tag" +--- + +This is the page about the "hello" tag, this is a placeholder for a longer description \ No newline at end of file diff --git a/plugins.py b/plugins.py index 5dd223e..3f2c3e2 100644 --- a/plugins.py +++ b/plugins.py @@ -36,6 +36,12 @@ class Service(Templated, Content): template: str="service/service_detail.html" summary: str +class TagSumamry(Templated, Content): + """This is a summary for a tag""" + name: str + template: str="tag_summary.html" + + @Site.register_context_provider def global_context(ctx): ctx['safe'] = SafeStr diff --git a/templates/tag_summary.html b/templates/tag_summary.html new file mode 100644 index 0000000..d9940f6 --- /dev/null +++ b/templates/tag_summary.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{% block title %}{{ this.title }}{% endblock %} +{% block css %}{% endblock %} + +{% block content %} +

{{ this.content }}

+{% endblock %} \ No newline at end of file From e673247376277cdbd6c8e52c4620ab52b35af5f8 Mon Sep 17 00:00:00 2001 From: Janis Lesinskis Date: Sun, 18 Aug 2019 22:32:02 -0400 Subject: [PATCH 2/3] Create short summary --- pages/tags/hello.md | 3 ++- plugins.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pages/tags/hello.md b/pages/tags/hello.md index 6db7fab..946197b 100644 --- a/pages/tags/hello.md +++ b/pages/tags/hello.md @@ -1,5 +1,6 @@ --- -ShortSummary: "Hello is an example tag" +name: "hello" +short_summary: "Hello is an example tag" --- This is the page about the "hello" tag, this is a placeholder for a longer description \ No newline at end of file diff --git a/plugins.py b/plugins.py index 3f2c3e2..ae92fcc 100644 --- a/plugins.py +++ b/plugins.py @@ -36,11 +36,11 @@ class Service(Templated, Content): template: str="service/service_detail.html" summary: str -class TagSumamry(Templated, Content): +class TagSummary(Templated, Content): """This is a summary for a tag""" name: str template: str="tag_summary.html" - + short_summary: str @Site.register_context_provider def global_context(ctx): From 9aae83c4298ef48661072f4d3f551ca45abec86c Mon Sep 17 00:00:00 2001 From: Janis Lesinskis Date: Mon, 19 Aug 2019 02:19:20 -0400 Subject: [PATCH 3/3] Start making utility to find URL for tag summary pages --- plugins.py | 9 +++++++++ templates/blog/post_detail.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins.py b/plugins.py index ae92fcc..2e418ae 100644 --- a/plugins.py +++ b/plugins.py @@ -45,4 +45,13 @@ class TagSummary(Templated, Content): @Site.register_context_provider def global_context(ctx): ctx['safe'] = SafeStr + return ctx + +def get_tag_url(tag: str): + """Get the URL for `tag` if it exists""" + return "" + +@Site.register_context_provider +def global_context(ctx): + ctx['get_tag_url'] = get_tag_url return ctx \ No newline at end of file diff --git a/templates/blog/post_detail.html b/templates/blog/post_detail.html index b1f4731..9660b01 100644 --- a/templates/blog/post_detail.html +++ b/templates/blog/post_detail.html @@ -22,5 +22,5 @@

Modified on .

{% include "team/team_list.html" author=author, members=site.content["team.yaml"].pages %} {% endfor %} -{% for tag in this.tags %}{% endfor %} +{% for tag in this.tags %}{% endfor %} {% endblock %} \ No newline at end of file