1
0
Fork 0

add a redirect if using old URL

This commit is contained in:
Kaan Genc 2022-01-01 17:53:58 -05:00
parent e08cf8895f
commit 95377a0472
3 changed files with 15 additions and 5 deletions

View File

@ -2,23 +2,27 @@
:source-paths #{"src"} :source-paths #{"src"}
:resource-paths #{"content"} :resource-paths #{"content"}
:dependencies '[[perun "0.5.0-SNAPSHOT" :scope "test"] :dependencies '[[perun "0.5.0-SNAPSHOT" :scope "test"]
[org.clojure/clojurescript "1.11.4"]
[adzerk/boot-cljs "2.1.5" :scope "test"]
[hiccup "2.0.0-alpha2" :exclusions [org.clojure/clojure]] [hiccup "2.0.0-alpha2" :exclusions [org.clojure/clojure]]
[garden "1.3.10"] [garden "1.3.10"]
[org.martinklepsch/boot-garden "1.3.2-0"] [org.martinklepsch/boot-garden "1.3.2-0"]
[pandeiro/boot-http "0.8.3" :exclusions [org.clojure/clojure]]]) [pandeiro/boot-http "0.8.3" :exclusions [org.clojure/clojure]]])
(require '[io.perun :as perun] (require '[io.perun :as perun]
'[adzerk.boot-cljs :refer [cljs]]
'[pandeiro.boot-http :refer [serve]] '[pandeiro.boot-http :refer [serve]]
'[org.martinklepsch.boot-garden :refer [garden]] '[org.martinklepsch.boot-garden :refer [garden]]
'[site.core]) '[site.core])
(deftask build [] (deftask build [o optimize? bool "Optimize css & js output"]
(comp (perun/draft) (comp (perun/draft)
(perun/pandoc :cmd-opts ["-f" "markdown" "-t" "html5"]) (perun/pandoc :cmd-opts ["-f" "markdown" "-t" "html5"])
(sift :to-resource #{#"^img/(.*)"}) (sift :to-resource #{#"^img/(.*)"})
(sift :to-resource #{#"^extra/(.*)"}) (sift :to-resource #{#"^extra/(.*)"})
(sift :to-resource #{#"^CNAME"}) (sift :to-resource #{#"^CNAME"})
(garden :styles-var 'site.styles/base :output-to "main.css") (garden :styles-var 'site.styles/base :output-to "main.css" :pretty-print (if optimize? false true))
(cljs :optimizations (if optimize? :advanced :none) :source-map (if optimize? false true))
(perun/ttr) ;; Time to read (perun/ttr) ;; Time to read
(perun/word-count) (perun/word-count)
(perun/render :renderer 'site.core/page) (perun/render :renderer 'site.core/page)
@ -29,14 +33,14 @@
:page "blog/index.html" :out-dir "") :page "blog/index.html" :out-dir "")
(perun/sitemap :filename "sitemap.xml") (perun/sitemap :filename "sitemap.xml")
(sift :move {#"^public/(.*)" "$1"}))) ; perun/render ignores out-dir for some reason (sift :move {#"^public/(.*)" "$1"}))) ; perun/render ignores out-dir for some reason
(deftask dev [] (deftask dev []
(comp (watch) (comp (watch)
(build) (build :optimize? false)
(serve :port 8000 :resource-root ""))) (serve :port 8000 :resource-root "")))
(deftask publish [] (deftask publish []
(comp (build) (comp (build :optimize? true)
(target :dir #{"docs"}))) (target :dir #{"docs"})))

View File

@ -0,0 +1,5 @@
(ns scripts.redirect)
;; Redirect to bgenc.net if it's using kaangenc.me
(let [location js/location] (when (= (.toLowerCase location.hostname) "kaangenc.me")
(location.replace (.join #js[location.protocol "//bgenc.net" location.pathname location.hash] ""))))

View File

@ -10,6 +10,7 @@
[:meta {:charset "utf-8"}] [:meta {:charset "utf-8"}]
[:link {:rel "stylesheet" :href "/main.css"}] [:link {:rel "stylesheet" :href "/main.css"}]
[:link {:rel "stylesheet" :href "/extra/emacs.css"}] [:link {:rel "stylesheet" :href "/extra/emacs.css"}]
[:script {:src "/main.js"}]
[:title (when title (str title " - ")) "Homepage of Kaan Genç"] [:title (when title (str title " - ")) "Homepage of Kaan Genç"]
[:link {:href [:link {:href
"https://fonts.googleapis.com/css2?family=Ubuntu+Mono&family=Ubuntu:ital,wght@0,400;0,700;1,400;1,700&display=swap" "https://fonts.googleapis.com/css2?family=Ubuntu+Mono&family=Ubuntu:ital,wght@0,400;0,700;1,400;1,700&display=swap"