Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Tag summary #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pages/tags/hello.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
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
15 changes: 15 additions & 0 deletions plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,22 @@ class Service(Templated, Content):
template: str="service/service_detail.html"
summary: str

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):
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
2 changes: 1 addition & 1 deletion templates/blog/post_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ <h4>Modified on <time datetime="">{{ this.modified }}</time>.</h4>
{% include "team/team_list.html" author=author, members=site.content["team.yaml"].pages %}
{% endfor %}

{% for tag in this.tags %}<a class="post-tag" href="" class="tags">{{ tag }}</a>{% endfor %}
{% for tag in this.tags %}<a class="post-tag" href="{{get_tag_url(tag)}}" class="tags">{{ tag }}</a>{% endfor %}
{% endblock %}
8 changes: 8 additions & 0 deletions templates/tag_summary.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "base.html" %}

{% block title %}{{ this.title }}{% endblock %}
{% block css %}<link rel="stylesheet" type="text/css" href="/static/css/pages/team.css">{% endblock %}

{% block content %}
<p>{{ this.content }}</p>
{% endblock %}