templates_blog_modules_DATA = \
src/templates/blog/modules/history-navigation.html \
- src/templates/blog/modules/list.html
+ src/templates/blog/modules/list.html \
+ src/templates/blog/modules/tag.html
templates_blog_modulesdir = $(templates_blogdir)/modules
@property
def excerpt(self):
- paragraphs = self.plaintext.split("\n\n")
+ paragraphs = self.text.replace("\r", "").split("\n\n")
excerpt = []
{% end %}
{% block container %}
- <section class="hero is-primary">
+ <section class="hero is-medium">
<div class="hero-body">
<div class="container">
- <nav class="breadcrumb" aria-label="breadcrumbs">
- <ul>
- <li>
- <a href="/">{{ _("Home") }}</a>
- </li>
- <li class="is-active">
- <a href="#" aria-current="page">{{ _("Blog") }}</a>
- </li>
- </ul>
- </nav>
+ <h1 class="title">
+ IPFire <span class="has-text-primary">Blog</span>
+ </h1>
- <h1 class="title">{{ _("IPFire Blog") }}</h1>
-
- {% if q %}
- <h6 class="subtitle">
+ <h5 class="subtitle is-5">
+ {% if q %}
{{ _("Search Results for '%s'") % q }}
- </h6>
- {% end %}
+ {% else %}
+ Releases, security updates, and stories from the IPFire community
+ {% end %}
+ </h5>
</div>
</div>
</section>
<section class="section">
<div class="container">
<div class="columns">
- <div class="column is-8">
- {% if latest_post %}
- <div class="notification">
- <h4 class="title is-4">
- <a href="/blog/{{ latest_post.slug }}">
- {{ _("Latest: %s") % latest_post.title }}
- </a>
- </h4>
-
- <div class="content">
- {{ latest_post.excerpt }}
- </div>
-
- <p>
- <a href="/blog/{{ latest_post.slug }}">{{ _("Read More") }}</a>
- </p>
- </div>
- {% end %}
-
+ <div class="column">
{% if q and not posts %}
<div class="notification">
{{ _("No Results Found For '%s'") % q }}
</div>
{% end %}
- {% module BlogList(posts, relative=True) %}
+ {% module BlogList(posts, latest=latest_post) %}
</div>
- <div class="column is-4">
+ <div class="column is-one-quarter">
{# Show a button to sign up for anonymous users #}
{% if not current_user %}
<div class="block">
-<div class="level">
- <div class="level-left">
- <div class="level-item">
- {{ _("Archive") }}
- </div>
+<div class="dropdown is-up">
+ <div class="dropdown-trigger">
+ <button class="button" aria-haspopup="true" aria-controls="blog-archive">
+ <span>
+ {{ _("Archive") }}
+ </span>
+
+ <span class="icon is-small">
+ <i class="fas fa-angle-up" aria-hidden="true"></i>
+ </span>
+ </button>
+ </div>
- {% for year in years %}
- <div class="level-item">
- <a href="/blog/years/{{ year }}">{{ year }}</a>
- </div>
- {% end %}
+ <div class="dropdown-menu" id="blog-archive" role="menu">
+ <div class="dropdown-content">
+ {% for year in years %}
+ <a href="/blog/years/{{ year }}" class="dropdown-item">
+ {{ year }}
+ </a>
+ {% end %}
+ </div>
</div>
</div>
{% for post in posts %}
- <p>
- <h5 class="title is-5">
- <a {% if "lightningwirelabs.com" in post.tags %}class="has-text-lwl"{% end %} href="/blog/{{ post.slug }}">
- {{ post.title }}
- </a>
- </h5>
-
- <h6 class="subtitle is-6">
- {% if post.published_at %}
- {{ locale.format_date(post.published_at, shorter=True, relative=relative) }}
- {% elif post.created_at %}
- {{ _("Created %s") % locale.format_date(post.created_at, shorter=True, relative=True) }}
- {% end %}
+ {# Highlight the latest post #}
+ {% set highlighted = (post == latest) %}
- {% if "lightningwirelabs.com" in post.tags %}
- <span class="has-text-lwl">{{ _("by Lightning Wire Labs") }}</span>
- {% elif show_author and post.author %}
- <a href="/users/{{ post.author.uid }}">{{ _("by %s") % post.author }}</a>
+ <article class="media">
+ <div class="media-content">
+ {% if highlighted %}
+ <p class="heading has-text-primary">
+ {{ _("Latest Post") }}
+ </p>
+ {% else %}
+ {% module BlogTag(post) %}
{% end %}
- </h6>
- </p>
+
+ <div class="level">
+ <div class="level-left">
+ <div class="level-item">
+ <p class="title {% if highlighted %}is-3{% else %}is-4{% end %}">
+ <a {% if "lightningwirelabs.com" in post.tags %}class="has-text-lwl"{% end %} href="/blog/{{ post.slug }}">
+ {{ post.title }}
+ </a>
+ </p>
+ </div>
+ </div>
+
+ {% if not highlighted and post.published_at %}
+ <div class="level-right">
+ <div class="level-item has-text-grey">
+ <small>
+ {{ locale.format_date(post.published_at, shorter=True, relative=False) }}
+ </small>
+ </div>
+ </div>
+ {% end %}
+ </div>
+
+ <div class="content">
+ {% module Markdown(post.excerpt) %}
+ </div>
+
+ <div class="level">
+ <div class="level-left">
+ <div class="level-item">
+ <small>
+ {% if "lightningwirelabs.com" in post.tags %}
+ <span class="has-text-lwl">
+ {{ _("by Lightning Wire Labs") }}
+ </span>
+ {% elif show_author and post.author %}
+ <span class="icon-text">
+ <span class="icon">
+ {% module Avatar(post.author, size=24) %}
+ </span>
+
+ <a href="/users/{{ post.author.uid }}">
+ {{ post.author }}
+ </a>
+ </span>
+ {% end %}
+ </small>
+ </div>
+
+ {% if highlighted %}
+ {% if post.published_at %}
+ <div class="level-item">
+ <small>
+ {{ locale.format_date(post.published_at, shorter=True, relative=True) }}
+ </small>
+ </div>
+ {% end %}
+
+ <div class="level-item">
+ {% module BlogTag(post) %}
+ </div>
+ {% end %}
+ </div>
+ </div>
+ </div>
+ </article>
{% end %}
--- /dev/null
+<div class="tags">
+ {% if "release" in post.tags %}
+ <span class="tag is-success">
+ {{ _("Release") }}
+ </span>
+ {% elif "testing" in post.tags %}
+ <span class="tag is-warning">
+ {{ _("Testing") }}
+ </span>
+ {% elif "security" in post.tags %}
+ <span class="tag is-danger">
+ {{ _("Security") }}
+ </span>
+ {% elif "community" in post.tags %}
+ <span class="tag is-info">
+ {{ _("Community") }}
+ </span>
+ {% end %}
+</div>
# Blog
"BlogHistoryNavigation": blog.HistoryNavigationModule,
"BlogList" : blog.ListModule,
+ "BlogTag" : blog.TagModule,
# Boot
"BootMenuConfig" : boot.MenuConfigModule,
posts = self.backend.blog.get_newest(limit=10)
# Extract the latest post
- latest_post = posts.pop(0)
+ if posts:
+ latest_post = posts[0]
self.render("blog/index.html", q=q, posts=posts, latest_post=latest_post)
class ListModule(ui_modules.UIModule):
- def render(self, posts, relative=False, show_author=True):
+ def render(self, posts, latest=None, show_author=True):
return self.render_string("blog/modules/list.html",
- posts=posts, relative=relative, show_author=show_author)
+ posts=posts, latest=latest, show_author=show_author)
+
+
+class TagModule(ui_modules.UIModule):
+ def render(self, post):
+ return self.render_string("blog/modules/tag.html", post=post)