added tags functionality
This commit is contained in:
@@ -4,5 +4,5 @@
|
||||
<section class="hero">
|
||||
<h2 style="color: #2563eb">What is this site?</h2>
|
||||
</section>
|
||||
I write articles about Arduino, STM32 and self-hosting. The articles are short and conceptual. It is not tutorials but more high level descriptions and general guidelines for reproducing the various things i tinker with.
|
||||
I write articles about Arduino, STM32 and Self-hosting. The articles are short and conceptual. It is not tutorials but more high level descriptions and general guidelines for reproducing the various things i tinker with.
|
||||
{% endblock %}
|
||||
@@ -10,6 +10,7 @@
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<nav class="container">
|
||||
@@ -22,13 +23,29 @@
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
<div class="layout-wrapper">
|
||||
<section class="content-area">
|
||||
{% block content %}{% endblock %}
|
||||
</section>
|
||||
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-section">
|
||||
<h3>Tags</h3>
|
||||
<ul class="tag-list">
|
||||
{% for tag in all_cloud_tags %}
|
||||
<li><a href="{{ url_for('tag', tag_name=tag) }}">#{{ tag }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
|
||||
<script
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,17 +2,26 @@
|
||||
|
||||
{% block content %}
|
||||
<section class="hero">
|
||||
<h2 style="color: #2563eb; margin-bottom : 10%">I write about Self-hosting, Arduino, STM32 and various tech stupidity.</h2>
|
||||
<h2 style="color: #2563eb; margin-bottom : 10%">I write about Self-hosting, Arduino, STM32.</h2>
|
||||
</section>
|
||||
|
||||
<div class="post-list">
|
||||
{% for post in posts %}
|
||||
<article class="post-item">
|
||||
<h3><a href="{{ url_for('post', path=post.path) }}">{{ post.title }}</a></h3>
|
||||
<span class="date">{{ post.date }}</span>
|
||||
<p>{{ post.meta.get('description', 'Read more...') }}</p>
|
||||
<p>{{ post.meta.get('tag', 'no tag') }}</p>
|
||||
</article>
|
||||
<article class="post-item">
|
||||
<h3>
|
||||
<a href="{{ url_for('post', path=post.path) }}" class="main-link">
|
||||
{{ post.title }}
|
||||
</a>
|
||||
</h3>
|
||||
<span class="date">{{ post.date }}</span>
|
||||
<p>{{ post.meta.get('description', 'Read more...') }}</p>
|
||||
|
||||
<div class="tags" style="position: relative; z-index: 2;">
|
||||
{% for tag in post.meta.get('tags', []) %}
|
||||
<a href="{{ url_for('tag', tag_name=tag) }}" class="tag-badge">#{{ tag }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</article>
|
||||
{% else %}
|
||||
<p>No posts yet. Time to write something!</p>
|
||||
{% endfor %}
|
||||
|
||||
@@ -5,5 +5,10 @@
|
||||
<p class="date">{{ page.date }}</p>
|
||||
<div class="post-body">
|
||||
{{ page.html|safe }} </div>
|
||||
{% for t in page.tags %}
|
||||
<a href="{{ url_for('tag', tag_name=t) }}">{{ t }}</a>{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
</article>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
16
templates/tag.html
Normal file
16
templates/tag.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Posts tagged with "{{ tag_name }}"</h2>
|
||||
|
||||
<div class="post-list">
|
||||
{% for p in pages %}
|
||||
<article class="post-item">
|
||||
<h3><a href="{{ url_for('post', path=p.path) }}">{{ p.title }}</a></h3>
|
||||
<span class="date">{{ p.date }}</span>
|
||||
</article>
|
||||
{% else %}
|
||||
<p>No posts found with this tag.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user