about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-07-04 13:47:18 -0700
committerFranck Cuny <franck@fcuny.net>2024-07-04 13:47:18 -0700
commitbb617eea58ac35679ed9568b103fdd8d5a0937b0 (patch)
tree3f555130bf1dcd31ad413515ade89f1e285d4448
parentfix yaml (diff)
downloadfcuny.net-bb617eea58ac35679ed9568b103fdd8d5a0937b0.tar.gz
add the feed and a few more fixes
-rw-r--r--config.toml14
-rw-r--r--content/_index.md7
-rw-r--r--content/blog/_index.md1
-rw-r--r--content/notes/_index.md1
-rw-r--r--flake.nix6
-rw-r--r--static/CNAME2
-rw-r--r--templates/base.html2
-rw-r--r--templates/feed.xml39
8 files changed, 60 insertions, 12 deletions
diff --git a/config.toml b/config.toml
index a818d67..e5264aa 100644
--- a/config.toml
+++ b/config.toml
@@ -1,13 +1,21 @@
 base_url = "https://fcuny.net/"
-default_language = "en"
-title = "Franck's rambling"
-output_dir = "docs"
 
+title = "@fcuny"
 author = "Franck Cuny"
 description = "Franck's website, with articles about computers stuff."
 
+output_dir = "docs"
+
+default_language = "en"
+
+generate_feed = true
+feed_filename = "feed.xml"
+
 [markdown]
 highlight_code = true
 highlight_theme = "idle"
 render_emoji = true
 smart_punctuation = true
+
+[extra]
+license = { name = "CC BY-SA 4.0", href = "https://creativecommons.org/licenses/by-sa/4.0/" }
diff --git a/content/_index.md b/content/_index.md
index ade4ba0..da8dcfd 100644
--- a/content/_index.md
+++ b/content/_index.md
@@ -1,7 +1,6 @@
-+++
-title = "home"
-template = "index.html"
-+++
+---
+title: "home"
+---
 
 My name is Franck Cuny and this is my little corner on the web.
 
diff --git a/content/blog/_index.md b/content/blog/_index.md
index 0de2091..d44a9f7 100644
--- a/content/blog/_index.md
+++ b/content/blog/_index.md
@@ -2,6 +2,5 @@
 title: Blog
 sort_by: date
 render: true
-generate_feeds: true
 template: blog.html
 ---
diff --git a/content/notes/_index.md b/content/notes/_index.md
index e3b7cd2..7e8d52b 100644
--- a/content/notes/_index.md
+++ b/content/notes/_index.md
@@ -2,6 +2,5 @@
 title: Note
 sort_by: date
 render: true
-generate_feeds: true
 template: blog.html
 ---
diff --git a/flake.nix b/flake.nix
index 3b11599..8f37065 100644
--- a/flake.nix
+++ b/flake.nix
@@ -26,7 +26,7 @@
               buildInputs = [ zola git ];
               buildPhase = ''
                 mkdir -p $out
-                ${pkgs.zola}/bin/zola build -o $out
+                ${pkgs.zola}/bin/zola build -o $out -f
               '';
               dontInstall = true;
             };
@@ -42,6 +42,10 @@
             src = ./.;
             hooks = {
               nixpkgs-fmt.enable = true;
+              check-toml.enable = true;
+              check-yaml.enable = true;
+              check-merge-conflicts.enable = true;
+              end-of-file-fixer.enable = true;
             };
           };
           formatting = treefmtEval.config.build.check self;
diff --git a/static/CNAME b/static/CNAME
index 7398ba2..9d43514 100644
--- a/static/CNAME
+++ b/static/CNAME
@@ -1 +1 @@
-fcuny.net
\ No newline at end of file
+fcuny.net
diff --git a/templates/base.html b/templates/base.html
index 7eeeaf6..75d108c 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -8,7 +8,7 @@
 
     <meta name="author" content="{{- config.author -}}" />
     <meta name="description" content="{%- block description -%}{{- config.description -}}{%- endblock description -%}" />
-    <link rel="alternate" type="application/atom+xml" title="Blog posts" href="{{ get_url(path="/blog/atom.xml", trailing_slash=false) }}" />
+    <link rel="alternate" type="application/atom+xml" title="Blog posts" href="{{ get_url(path="/feed.xml", trailing_slash=false) }}" />
 
     <title>{% block title %}{{- config.title -}}{% endblock title %}</title>
   </head>
diff --git a/templates/feed.xml b/templates/feed.xml
new file mode 100644
index 0000000..2ac0851
--- /dev/null
+++ b/templates/feed.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}">
+    <title>{{ config.title }}</title>
+    <link rel="self" type="application/atom+xml" href="{{ feed_url | safe }}"/>
+    <updated>{{ last_updated | date(format="%+") }}</updated>
+    <id>{{ feed_url | safe }}</id>
+    {%- set blog = get_section(path="blog/_index.md") -%}
+    {%- for page in blog.pages %}
+    <entry xml:lang="{{ page.lang }}">
+        <title>{{ page.title }}</title>
+        <published>{{ page.date | date(format="%+") }}</published>
+        <updated>{{ page.updated | default(value=page.date) | date(format="%+") }}</updated>
+        {% for author in page.authors %}
+        <author>
+          <name>
+            {{ author }}
+          </name>
+        </author>
+        {% else %}
+        <author>
+          <name>
+            {%- if config.author -%}
+              {{ config.author }}
+            {%- else -%}
+              Unknown
+            {%- endif -%}
+          </name>
+        </author>
+        {% endfor %}
+        <link rel="alternate" type="text/html" href="{{ page.permalink | safe }}"/>
+        <id>{{ page.permalink | safe }}</id>
+        {% if page.summary %}
+        <summary type="html">{{ page.summary }}</summary>
+        {% else %}
+        <content type="html" xml:base="{{ page.permalink | escape_xml | safe }}">{{ page.content }}</content>
+        {% endif %}
+    </entry>
+    {%- endfor %}
+</feed>