Support for link posts through the Link: metadata field

main
Michiel Scholten 2020-01-06 12:50:02 +01:00 committed by Vitaly Potyarkin
parent 77b73d0ab2
commit 9f2ca43677
4 changed files with 18 additions and 2 deletions

View File

@ -12,7 +12,7 @@
<dl class="row">
{% for article in dates %}
<dt class="col-sm-4">{{ article.locale_date }}</dt>
<dd class="col-sm-8"><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a></dd>
<dd class="col-sm-8"><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}{% if article.link %} <i class="fas fa-link"></i>{% endif %}</a></dd>
{% endfor %}
</dl>
{% endblock %}

View File

@ -10,7 +10,13 @@
{% endblock %}
{% block page_header %}
{% if article.link %}
<a href="{{ article.link }}" rel="bookmark">
{% endif %}
{{ article.title }}
{% if article.link %}
<i class="fas fa-link"></i></a>
{% endif %}
{% endblock %}
{% block content %}
@ -53,6 +59,11 @@
</header>
<div class="content">
{{ article.content }}
{% if article.link %}
<p class="link-button"><a href="{{ article.link }}" rel="bookmark">
<i class="fas fa-link"></i> view link
</a></p>
{% endif %}
</div>
</article>
{% include 'include/comments.html' %}

View File

@ -40,7 +40,7 @@
</header>
<div class="col-sm-8">
<h4 class="title">
<a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a>
<a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}{% if article.link %} <i class="fas fa-link"></i>{% endif %}</a>
</h4>
<div class="content">
{{ article.summary|striptags }}

View File

@ -59,6 +59,11 @@ RFG_FAVICONS = True
unzip -l <PATH_TO_PACKAGE>.zip
```
## Link posts
When adding a Link: field to the post's metadata header, the article will be rendered as a link post, which means a link icon will appear behind its title, and the title of the article will link to the destination of the link when viewing the article page. In that same page a 'view link' link/button will be rendered at the end of the content.
## Use `sitemap.xml`
There is a `sitemap.html` Jinja2 template that can be used to [generate a sitemap](https://github.com/getpelican/pelican/wiki/Tips-n-Tricks#generate-sitemapxml).