Fix to use unique URL name for better SEO

parent 444fe74d
......@@ -25,7 +25,7 @@
(colt config))
;; TODO: use cache
(get "/articles/:oid"
(get "/articles/oid/:oid"
#:cache #t
(lambda (rc)
(let ((article-content (tpl->html (get-one-article-by-oid (params rc "oid"))))
......@@ -33,8 +33,21 @@
(view-render "article" (the-environment)))))
;; TODO: use cache
(get "/articles/preview/:oid"
(get "/articles/preview/oid/:oid"
#:cache #t
(lambda (rc)
(let ((article-content (tpl->html (get-one-article-by-oid (params rc "oid")))))
(view-render "preview" (the-environment)))))
(get "/articles/preview/:name"
#:cache #t
(lambda (rc)
(let ((article-content (get-one-article (params rc "name"))))
(view-render "preview" (the-environment)))))
(get "/articles/:name"
#:cache #t
(lambda (rc)
(let ((article-content (get-one-article (params rc "name")))
(account (colt-conf-get 'disqus)))
(view-render "article" (the-environment)))))
......@@ -162,10 +162,10 @@
(define* (gen-one-post post mode #:optional (need-abstract? #f))
(define-syntax-rule (->url url-name)
(format #f "/articles/~a" (uri-decode url-name)))
(format #f "/articles/~a" url-name))
(define-syntax-rule (->title title url)
`(div (@ (class "blog-post-title"))
(a (@ (href ,(->url (post-oid post)))) ,title)))
(a (@ (href ,(->url (post-url-name post)))) ,title)))
(define-syntax-rule (->author author)
`(a (@ (href ,(colt-conf-get 'github-url))
(id "author"))
......@@ -186,7 +186,7 @@
((string=? mode "simplified")
`(div (@ (class "blog-post-content"))
,(trim-content content)
(div (a (@ (href ,(->url (post-oid post)))) "More..."))))
(div (a (@ (href ,(->url (post-url-name post)))) "More..."))))
((string=? mode "edit")
`(div (@ (class "blog-post-content"))
,content))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment