Browse Source

tags on index pages

master
Vincent Truchseß 11 months ago
parent
commit
6b9b7fd4af
3 changed files with 43 additions and 26 deletions
  1. +3
    -0
      site/css/default.css
  2. +35
    -24
      src/proton/site.clj
  3. +5
    -2
      src/proton/writers.clj

+ 3
- 0
site/css/default.css View File

@@ -83,6 +83,9 @@ code {
margin-bottom: 12px;
}

.postlist {
margin-bottom: 25px;
}

h1 {
font-size:2.4rem


+ 35
- 24
src/proton/site.clj View File

@@ -12,32 +12,39 @@
;; proton.rss rss
(let [t (tpl/template-from-file "templates/custom/default.clj")
post-t (tpl/template-from-file "templates/custom/post.clj")
index-t (tpl/template-from-file "templates/custom/index.clj")
tech-posts-old (wr/compile-posts t post-t "posts" "posts" [:tagdir "tags"])
tech-posts-new (wr/compile-posts t post-t "tech" "tech" [:tagdir "tags"])
tech-posts (ut/merge-feeds tech-posts-old tech-posts-new)
blag-posts (wr/compile-posts t post-t "blag" "blag" [:tagdir "tags"])
merged-posts (ut/merge-feeds tech-posts blag-posts)
grouped-posts (ut/group-posts-by-tags merged-posts)
tech-tags (keys (ut/group-posts-by-tags tech-posts))
blag-tags (keys (ut/group-posts-by-tags 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/tech/rss.xml"
:author "Vincent Truchseß"
:max-items 20}
:link "https://blog.fyber.space"
:host "blog.fyber.space"
:description "VI's small tech-blog"
: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 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}]
:link "https://blog.fyber.space/blag.html"
:host "blog.fyber.space"
: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}
index-opts {:tags (keys grouped-posts)
:tagdir "tags"}]

;; Static pages
(wr/compile-page t "about.adoc" "about.html")
(wr/compile-page t "contact.adoc" "contact.html")
@@ -45,20 +52,24 @@
;; 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)
(wr/write-index-with-posts t index-t merged-posts "index.adoc" "index.html"
index-opts)

(rss/write-feed merged-posts merged-rss-opts)
;; blag page
(wr/write-index-with-posts t
tpl/default-index-template
index-t
blag-posts
"blag.adoc"
"blag.html")
"blag.html"
(into index-opts {:tags blag-tags}))
(rss/write-feed blag-posts blag-rss-opts "blag/rss.xml")
;; tech-blog page
(wr/write-index-with-posts t
tpl/default-index-template
index-t
tech-posts
"tech.adoc"
"tech.html")
"tech.html"
(into index-opts {:tags tech-tags}))
(rss/write-feed tech-posts tech-rss-opts "tech/rss.xml")
(wr/write-tag-pages t (ut/group-posts-by-tags merged-posts))))

+ 5
- 2
src/proton/writers.clj View File

@@ -15,7 +15,7 @@
hiccup html-template. Takes the n most recent posts if n is provided."
([posts basedir n] (gen-postlist (take n posts) basedir))
([posts basedir]
(into [:ul]
(into [:ul {:class "postlist"}]
(map #(vector :li
[:a {:href (io/file basedir (:url %))} (:title %)]
(str " - " (ut/pretty-date %)))
@@ -92,11 +92,14 @@
([template index-template posts]
(write-index-with-posts template index-template posts "index.adoc" "index.html"))
([template index-template posts infile outfile]
(write-index-with-posts template index-template posts infile outfile {}))
([template index-template posts infile outfile extras]
(let [page (ad/adoc-load infile)]
(write-page template outfile (index-template nil nil
(:content page)
nil
{:postlist (gen-postlist posts (base-url outfile) 10)})
(into extras {:postlist (gen-postlist posts (base-url outfile) 10)
:basedir (base-url outfile)}))
(:title page)))))

(defn write-tag-pages


Loading…
Cancel
Save