Browse Source

Unified feeds and index page

started working on unified index paeg

finished unified feeds and index page
master
Vincent Truchseß 1 year ago
parent
commit
d76037221b
5 changed files with 52 additions and 25 deletions
  1. +5
    -0
      feeds.adoc
  2. +36
    -18
      src/proton/site.clj
  3. +3
    -0
      tech.adoc
  4. +4
    -4
      templates/custom/default-blag.clj
  5. +4
    -3
      templates/custom/default.clj

+ 5
- 0
feeds.adoc View File

@@ -0,0 +1,5 @@
= RSS Feeds

* link:rss.xml[All Posts]
* link:tech/rss.xml[Tech Posts]
* link:blag/rss.xml[Blag Posts]

+ 36
- 18
src/proton/site.clj View File

@@ -1,7 +1,8 @@
(ns proton.site
(:require [proton.templates :as tpl])
(:require [proton.writers :as wr])
(:require [proton.rss :as rss]))
(:require [proton.rss :as rss])
(:require [proton.util :as ut]))

(defn site []
;;This function gets loaded at runtime into proton.core. The available namespaces are
@@ -10,33 +11,50 @@
;; proton.writers wr
;; proton.rss rss
(let [t (tpl/template-from-file "templates/custom/default.clj")
blag-t (tpl/template-from-file "templates/custom/default-blag.clj")
posts (wr/compile-posts t tpl/default-post-template)
blag-posts (wr/compile-posts blag-t tpl/default-post-template "blag")
rss-opts {:title "VI's Blog"
tech-posts (wr/compile-posts t tpl/default-post-template)
blag-posts (wr/compile-posts t tpl/default-post-template "blag")
merged-posts (ut/merge-feeds tech-posts blag-posts)
tech-rss-opts {:title "VI's Tech-Blog"
:link "https://blog.fyber.space"
:host "blog.fyber.space"
:description "VI's small tech-blog"
:rss-link "https://blog.fyber.space/rss.xml"
:rss-link "https://blog.fyber.space/tech/rss.xml"
:author "Vincent Truchseß"
:max-items 20}
blag-rss-opts {:title "VI's Blag"
:link "https://blog.fyber.space/blag.html"
:host "blog.fyber.space"
:description "VI's small tech-blog"
:description "VI's small blag"
:rss-link "https://blog.fyber.space/blag/rss.xml"
:author "Vincent Truchseß"
:max-items 20}
merged-rss-opts {:title "VI's Blog"
:link "https://blog.fyber.space"
:host "blog.fyber.space"
:description "VI's small blog"
:rss-link "https://blog.fyber.space/rss.xml"
:author "Vincent Truchseß"
:max-items 20}]
;; Static pages
(wr/compile-page t "about.adoc" "about.html")
(wr/compile-page t "contact.adoc" "contact.html")
(wr/write-archive-page t posts "archive.html")
(wr/write-index-with-posts t tpl/default-index-template posts)
(rss/write-feed posts rss-opts)
(wr/write-index-with-posts
blag-t
tpl/default-index-template
blag-posts
"blag.adoc"
"blag.html")
(wr/write-archive-page blag-t blag-posts "blag/archive.html")
(rss/write-feed blag-posts blag-rss-opts "blag/rss.xml")))
(wr/compile-page t "feeds.adoc" "feeds.html")
;; Archive Page
(wr/write-archive-page t merged-posts "archive.html")
;; Index page and merged feed
(wr/write-index-with-posts t tpl/default-index-template merged-posts)
(rss/write-feed merged-posts merged-rss-opts)
;; blag page
(wr/write-index-with-posts t
tpl/default-index-template
blag-posts
"blag.adoc"
"blag.html")
(rss/write-feed blag-posts blag-rss-opts "blag/rss.xml")
;; tech-blog page
(wr/write-index-with-posts t
tpl/default-index-template
tech-posts
"tech.adoc"
"tech.html")
(rss/write-feed tech-posts tech-rss-opts "tech/rss.xml")))

+ 3
- 0
tech.adoc View File

@@ -0,0 +1,3 @@
= VI's Tech Blog

This is the Tech-related part of my blog.

+ 4
- 4
templates/custom/default-blag.clj View File

@@ -21,9 +21,9 @@
(map (fn [[url label]]
[:a {:href (str (:base-url extras) url)} label])
[["index.html" "Home"]
["blag.html" "Blag"]
["tech.html" "Tech-Blog"]
["about.html" "About"]
["blag/archive.html" "Archive"]
["archive.html" "Archive"]
["contact.html" "Contact"]]))]
[:main {:role "main"}
[:h1 title]
@@ -32,9 +32,9 @@
[:a {:href (str (:base-url extras) "contact.html")
:style "float: left; padding-right: 8px;"}
"Impress"]
[:a {:href (str (:base-url extras) "blag/rss.xml")
[:a {:href (str (:base-url extras) "feeds.html")
:style "float: left; padding-right: 8px;"}
"RSS feed"]
"RSS feeds"]
[:a {:href (str (:base-url extras) "https://git.fyber.space/vincent/blog-ng")
:style "float: left;"}
"source"]


+ 4
- 3
templates/custom/default.clj View File

@@ -15,12 +15,13 @@
[:body
[:header
[:div {:class "logo"}
[:a {:href (:base-url extras)}
[:a {:href (str (:base-url extras) "index.html")}
[:img {:src (str (:base-url extras) "logo.png")}]]]
(into [:nav]
(map (fn [[url label]]
[:a {:href (str (:base-url extras) url)} label])
[["index.html" "Home"]
["tech.html" "Tech Blog"]
["blag.html" "Blag"]
["about.html" "About"]
["archive.html" "Archive"]
@@ -32,9 +33,9 @@
[:a {:href (str (:base-url extras) "contact.html")
:style "float: left; padding-right: 8px;"}
"Impress"]
[:a {:href (str (:base-url extras) "rss.xml")
[:a {:href (str (:base-url extras) "feeds.html")
:style "float: left; padding-right: 8px;"}
"RSS feed"]
"RSS feeds"]
[:a {:href (str (:base-url extras) "https://git.fyber.space/vincent/blog-ng")
:style "float: left;"}
"source"]


Loading…
Cancel
Save