mirror of
https://github.com/ParkerTenBroeck/ParkerTenBroeck.github.io.git
synced 2026-06-06 21:14:06 -04:00
improving feeds
This commit is contained in:
parent
72c2bd4b59
commit
6950c0772c
3 changed files with 22 additions and 10 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
{% import "macros/feed.html" as feed_macros %}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
|
|
@ -14,10 +16,12 @@
|
||||||
{%- endblock -%}
|
{%- endblock -%}
|
||||||
</title>
|
</title>
|
||||||
|
|
||||||
{% block feeds %}
|
{%- if config.generate_feeds %}
|
||||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path='rss.xml', trailing_slash=false) }}">
|
{%- for feed in config.feed_filenames -%}
|
||||||
<link rel="alternate" type="application/atom+xml" title="Atom" href="{{ get_url(path='atom.xml', trailing_slash=false) }}">
|
{{ feed_macros::link_alternate(filename=feed, title=config.title) }}
|
||||||
{% endblock %}
|
{% endfor -%}
|
||||||
|
{%- block feeds -%}{%- endblock -%}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{ get_url(path='style.css', cachebust=true) }}">
|
<link rel="stylesheet" href="{{ get_url(path='style.css', cachebust=true) }}">
|
||||||
|
|
||||||
|
|
|
||||||
10
templates/macros/feed.html
Normal file
10
templates/macros/feed.html
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{%- macro link_alternate(filename, title) -%}
|
||||||
|
{%- if filename is ending_with("atom.xml") -%}
|
||||||
|
{%- set type = 'type="application/atom+xml" ' -%}
|
||||||
|
{%- elif filename is ending_with("rss.xml") -%}
|
||||||
|
{%- set type = 'type="application/rss+xml" ' -%}
|
||||||
|
{%- elif filename is ending_with(".json") -%}
|
||||||
|
{%- set type = 'type="application/feed+json" ' -%}
|
||||||
|
{%- endif -%}
|
||||||
|
<link rel="alternate" {{ type | default(value="") | safe -}} href="{{ get_url(path=filename) }}" title="{{ title | replace(from='"', to=""") | safe }}">
|
||||||
|
{%- endmacro -%}
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% import "macros/taxonomy.html" as macros %}
|
{% import "macros/taxonomy.html" as macros %}
|
||||||
{% import "macros/post.html" as posts %}
|
{% import "macros/post.html" as posts %}
|
||||||
|
{% import "macros/feed.html" as feed_macros %}
|
||||||
|
|
||||||
{%- block title -%}
|
{%- block title -%}
|
||||||
{{ term.name | title }} | {{ config.title }}
|
{{ term.name | title }} | {{ config.title }}
|
||||||
{%- endblock -%}
|
{%- endblock -%}
|
||||||
|
|
||||||
{# {%- block feeds -%}
|
{%- block feeds -%}
|
||||||
{%- if taxonomy.feed -%}
|
{%- if taxonomy.feed -%}
|
||||||
{%- for filename in config.feed_filenames -%}
|
{%- for filename in config.feed_filenames -%}
|
||||||
|
|
||||||
|
|
@ -18,14 +19,11 @@
|
||||||
{%- set feed_title = config.title ~ " | Posts in the '" ~ term.name ~ "' " ~ singular_name -%}
|
{%- set feed_title = config.title ~ " | Posts in the '" ~ term.name ~ "' " ~ singular_name -%}
|
||||||
{%- set feed_filename = taxonomy.name ~ "/" ~ term.name ~ "/" ~ filename -%}
|
{%- set feed_filename = taxonomy.name ~ "/" ~ term.name ~ "/" ~ filename -%}
|
||||||
{{ feed_macros::link_alternate(filename=feed_filename, title=feed_title) }}
|
{{ feed_macros::link_alternate(filename=feed_filename, title=feed_title) }}
|
||||||
|
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endblock -%} #}
|
{%- endblock -%}
|
||||||
|
|
||||||
{% block rss %}
|
|
||||||
{% set rss_path = "tags/" ~ term.name ~ "/rss.xml" %}
|
|
||||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path=rss_path, trailing_slash=false) }}">
|
|
||||||
{% endblock rss %}
|
|
||||||
|
|
||||||
{%- block main -%}
|
{%- block main -%}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue