Browse Source

Support for link posts through the Link: metadata field

main
Michiel Scholten 3 years ago
committed by Vitaly Potyarkin
parent
commit
9f2ca43677
  1. 2
      alchemy/templates/archives.html
  2. 11
      alchemy/templates/article.html
  3. 2
      alchemy/templates/index.html
  4. 5
      docs/pelican-tips.md

2
alchemy/templates/archives.html

@ -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 %}

11
alchemy/templates/article.html

@ -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' %}

2
alchemy/templates/index.html

@ -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 }}

5
docs/pelican-tips.md

@ -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).

Loading…
Cancel
Save