Commit 84ce10cc authored by Artemiy's avatar Artemiy
Browse files

linkify tags

parent 4e6863cb
...@@ -249,6 +249,13 @@ let categories_count = ...@@ -249,6 +249,13 @@ let categories_count =
let l = Hashtbl.fold (fun k v acc -> (k, v) :: acc) tbl [] in let l = Hashtbl.fold (fun k v acc -> (k, v) :: acc) tbl [] in
List.sort (fun (k1, v1) (k2, v2) -> compare (v2, k2) (v1, k1)) l List.sort (fun (k1, v1) (k2, v2) -> compare (v2, k2) (v1, k1)) l
let pp_list_to_blog_links t =
Format.pp_print_list
~pp_sep:(fun fmt () -> Format.fprintf fmt ", ")
(fun fmt e ->
Format.fprintf fmt {|<a href="/blog/%s/%s">%s</a>|} t (normalize_url e) e
)
let links_to_home_pages = let links_to_home_pages =
Format.sprintf Format.sprintf
{| {|
...@@ -303,17 +310,11 @@ let pp_article_excerpt fmt article = ...@@ -303,17 +310,11 @@ let pp_article_excerpt fmt article =
<br /> <br />
%s <a href="/blog/%s">(Read more)</a>|} %s <a href="/blog/%s">(Read more)</a>|}
article.url article.title article.url article.title
(Format.pp_print_list (pp_list_to_blog_links "authors")
~pp_sep:(fun fmt () -> Format.fprintf fmt ", ")
(fun fmt author ->
Format.fprintf fmt {|<a href="/blog/authors/%s">%s</a>|}
(normalize_url author) author ) )
article.authors year month day article.authors year month day
(normalize_url article.category) (normalize_url article.category)
article.category article.category
(Format.pp_print_list (pp_list_to_blog_links "tag")
~pp_sep:(fun fmt () -> Format.fprintf fmt ", ")
Format.pp_print_string )
article.tags (preview article.content) article.url article.tags (preview article.content) article.url
let pp_blog_posts fmt articles_data_list = let pp_blog_posts fmt articles_data_list =
...@@ -332,7 +333,7 @@ let specific_article_header title authors (year, month, day) category tags = ...@@ -332,7 +333,7 @@ let specific_article_header title authors (year, month, day) category tags =
<div class="row"> <div class="row">
<div class="col-lg-3"> <div class="col-lg-3">
<img class="icon" src="/blog/assets/img/icon_person.svg"/> <img class="icon" src="/blog/assets/img/icon_person.svg"/>
Author: %a Authors: %a
</div> </div>
<div class="col-lg-2"> <div class="col-lg-2">
<img class="icon" src="/blog/assets/img/icon_calendar.svg"/> <img class="icon" src="/blog/assets/img/icon_calendar.svg"/>
...@@ -354,15 +355,9 @@ let specific_article_header title authors (year, month, day) category tags = ...@@ -354,15 +355,9 @@ let specific_article_header title authors (year, month, day) category tags =
<hr class="featurette-divider"/> <hr class="featurette-divider"/>
<br />|} <br />|}
title title
(Format.pp_print_list (pp_list_to_blog_links "authors")
~pp_sep:(fun fmt () -> Format.fprintf fmt ", ")
(fun fmt author ->
Format.fprintf fmt {|<a href="/blog/authors/%s">%s</a>|}
(normalize_url author) author ) )
authors year month day (normalize_url category) category authors year month day (normalize_url category) category
(Format.pp_print_list (pp_list_to_blog_links "tag")
~pp_sep:(fun fmt () -> Format.fprintf fmt ", ")
Format.pp_print_string )
tags tags
(** [given_category category] Displays the list of articles corresponding to the (** [given_category category] Displays the list of articles corresponding to the
......
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