Skip to content

Commit

Permalink
Merge pull request #9 from 1peter10/feat/zola-0.19.1
Browse files Browse the repository at this point in the history
Change feed logic and adjust _index.md for Zola 0.19.1
  • Loading branch information
cydave authored Jul 28, 2024
2 parents 28d9fa9 + dde5e01 commit a34388c
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 23 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
![](screenshot.png)


A work in progress port of the [hugo-PaperMod](https://github.com/adityatelange/hugo-PaperMod) theme by [@adityatelange](https://github.com/adityatelange) to [Zola](https://www.getzola.org/)
A work in progress port of the [hugo-PaperMod](https://github.com/adityatelange/hugo-PaperMod) theme by [@adityatelange](https://github.com/adityatelange) to [Zola](https://www.getzola.org/)

Due to config changes introduced with Zola 0.19, only Zola 0.19.1 and later are currently supported.

Demo @ https://cydave.github.io/zola-theme-papermod/

Expand All @@ -14,6 +16,7 @@ Demo @ https://cydave.github.io/zola-theme-papermod/
+ [x] Blog post RSS feeds
+ [x] Tags
+ [x] Tag-based RSS feeds
+ [x] Optional: Custom taxonomies
+ [x] Light / Dark theme switching (with configurable default preference)
+ [x] Syntax highlighting for code snippets (Zola's built-in syntax highlighting)
+ [x] Custom navigation
Expand All @@ -22,7 +25,7 @@ Demo @ https://cydave.github.io/zola-theme-papermod/
+ [ ] Home-Info Mode
+ [ ] Profile Mode
+ [x] Code copy buttons
+ [ ] Search page
+ [x] Search page
+ [ ] SEO Metadata
+ [ ] Language switcher (multi-language support)

Expand Down
5 changes: 3 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ author = "cydave"
title = "PaperMod"
base_url = "https://cydave.github.io/zola-theme-papermod"
compile_sass = true
build_search_index = false
generate_feed = true
build_search_index = true
generate_feeds = true
feed_filenames = [ "atom.xml",]
minify_html = true


Expand Down
1 change: 0 additions & 1 deletion content/archive/_index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
+++
date = "2023-05-11T00:00:00"
template = "archive.html"
+++
2 changes: 1 addition & 1 deletion content/posts/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ title = "Posts"
sort_by = "date"
paginate_by = 5
insert_anchor_links = "right"
generate_feed = true
generate_feeds = true
transparent = true
+++
2 changes: 1 addition & 1 deletion content/tags/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Tags"
paginate_by = 10
generate_feed = true
generate_feeds = true
+++

6 changes: 4 additions & 2 deletions templates/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
#}
{% endblock %}

{% if config.generate_feed %}
<link rel="alternate" type={% if config.feed_filename == "atom.xml" %}"application/atom+xml"{% else %}"application/rss+xml"{% endif %} title="RSS" href="{{ get_url(path=config.feed_filename) | safe }}">
{% if config.generate_feeds %}
{% for feed_filename in config.feed_filenames %}
<link rel="alternate" type={% if feed_filename == "atom.xml" %}"application/atom+xml"{% else %}"application/rss+xml"{% endif %} title="RSS" href="{{ get_url(path=feed_filename) | safe }}">
{% endfor %}
{% endif %}

<noscript>
Expand Down
16 changes: 9 additions & 7 deletions templates/section.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
<a href="{{ config.base_url }}">Home</a>
</div>
<h1>{{ section.title }}
<a href="{{ get_url(path=config.feed_filename, trailingslash=false) | safe }}" title="RSS" aria-label="RSS">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" height="23">
<path d="M4 11a9 9 0 0 1 9 9"></path>
<path d="M4 4a16 16 0 0 1 16 16"></path>
<circle cx="5" cy="19" r="1"></circle>
</svg>
</a>
{% for feed_filename in config.feed_filenames %}
<a href="{{ get_url(path=feed_filename, trailingslash=false) | safe }}" title="RSS" aria-label="RSS">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" height="23">
<path d="M4 11a9 9 0 0 1 9 9"></path>
<path d="M4 4a16 16 0 0 1 16 16"></path>
<circle cx="5" cy="19" r="1"></circle>
</svg>
</a>
{% endfor %}
</h1>
</header>
{% for page in paginator.pages %}
Expand Down
16 changes: 9 additions & 7 deletions templates/tags/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
<a href="{{ current_url }}">{{ term.name }}</a>
</div>
<h1>{{ term.name }}
<a href="{{ term.permalink ~ config.feed_filename }}" title="RSS" aria-label="RSS">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" height="23">
<path d="M4 11a9 9 0 0 1 9 9"></path>
<path d="M4 4a16 16 0 0 1 16 16"></path>
<circle cx="5" cy="19" r="1"></circle>
</svg>
</a>
{% for feed_filename in config.feed_filenames %}
<a href="{{ term.permalink ~ feed_filename }}" title="RSS" aria-label="RSS">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" height="23">
<path d="M4 11a9 9 0 0 1 9 9"></path>
<path d="M4 4a16 16 0 0 1 16 16"></path>
<circle cx="5" cy="19" r="1"></circle>
</svg>
</a>
{% endfor %}
</h1>
</header>
{% for page in term.pages %}
Expand Down
19 changes: 19 additions & 0 deletions templates/taxonomy_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends "index.html" %}
{% block main %}
{% if not title %}
{% set title = "All " ~ taxonomy.name | replace(from="_",to=" ") | title %}
{% set css_class = "terms-" ~ taxonomy.name %}
{% endif %}

<header class="page-header">
<h1>{{ title }}</h1>
</header>

<ul class="terms-tags {{ css_class }}">
{% for term in terms %}
<li>
<a href="{{ term.permalink }}">{{ term.name }} <sup><strong><sup>{{ term.page_count }}</sup></strong></sup> </a>
</li>
{% endfor %}
</ul>
{% endblock %}
39 changes: 39 additions & 0 deletions templates/taxonomy_single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% extends "index.html" %}
{% block main %}
{% set taxonomy_title = taxonomy.name | replace(from="_",to=" ") | title %}

<header class="page-header">
<div class="breadcrumbs">
<a href="{{ config.base_url }}">Home</a>&nbsp;»&nbsp;
<a href="{{ config.base_url }}/{{ taxonomy.name }}">{{ taxonomy_title }}</a>&nbsp;»&nbsp;
<a href="{{ current_url }}">{{ term.name }}</a>
</div>
<h1>{{ term.name | replace(from="_",to=" ") | title }}
{% for feed_filename in config.feed_filenames %}
<a href="{{ term.permalink ~ feed_filename }}" title="RSS" aria-label="RSS">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" height="23">
<path d="M4 11a9 9 0 0 1 9 9"></path>
<path d="M4 4a16 16 0 0 1 16 16"></path>
<circle cx="5" cy="19" r="1"></circle>
</svg>
</a>
{% endfor %}
</h1>
</header>
{% for page in term.pages %}
<article class="post-entry">
<header class="entry-header">
<h2>{{ page.title }}</h2>
</header>
{% if page.summary %}
<div class="entry-content">
<p>{{ page.summary | safe }}</p>
</div>
{% endif %}
<footer class="entry-footer">
{% include "partials/post_meta.html" %}
</footer>
<a class="entry-link" aria-label="post link to {{ page.title }}" href="{{ page.permalink }}"></a>
</article>
{% endfor %}
{% endblock %}

0 comments on commit a34388c

Please sign in to comment.