index.twig 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. {%- apply spaceless -%}{%- set search_tooltip = 'The search function is primitive. It only searches for the literal string as entered. – "fluffy cloud" will only search the exact string "fluffy cloud" – and not "fluffy" OR "cloud". – Searches are case insensitive, tags and some special characters are stripped.' -%}<!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
  6. <title>{% if meta.title %}{{ meta.title }} | {% endif %}{{ site_title }}</title>
  7. <link rel="icon" type="image/x-icon" href="/favicon.ico">
  8. {%- if meta.description -%}<meta name="description" content="{{- meta.description -}}"/>
  9. {# i don't understand what og:... is good for. i hope i'm doing this right. #}
  10. <meta property="og:description" content="{{- meta.description -}}"/>{%- endif -%}
  11. {%- if meta.robots -%}
  12. <meta name="robots" content="{{- meta.robots -}}">{%- endif -%}
  13. {# i don't understand what og:... is good for. i hope i'm doing this right. #}
  14. <meta property="og:type" content="{{- current_page.meta.template -}}"/>
  15. <meta property="og:title" content="{{ current_page.title }} | {{ site_title }}"/>
  16. <meta property="og:url" content="{{- current_page.url -}}"/>
  17. <meta property="og:site_name" content="{{- site_title -}}"/>
  18. {%- if current_page -%}
  19. <link rel="canonical" href="{{- current_page.url -}}" />
  20. {%- endif -%}
  21. <link rel="stylesheet" href="{{-theme_url-}}/css/style.css" type="text/css" />
  22. <style>*{scrollbar-color:{%- if config.tb_col.scrollbar_fg -%}{{- config.tb_col.scrollbar_fg -}}{%- else -%}{{- "#aaa" -}}{%- endif -%} {%- if config.tb_col.def_bg -%}{{- config.tb_col.def_bg -}}{%- else -%}{{- "#eee" -}}{%- endif -%}}::-webkit-scrollbar-thumb{background:{%- if config.tb_col.scrollbar_fg -%}{{- config.tb_col.scrollbar_fg -}}{%- else -%}{{- "#aaa" -}}{%- endif -%}}::-webkit-scrollbar-track{background:{%- if config.tb_col.def_bg -%}{{- config.tb_col.def_bg -}}{%- else -%}{{- "#eee" -}}{%- endif -%}}body{color:{%- if config.tb_col.def_fg -%}{{- config.tb_col.def_fg -}}{%- else -%}{{- "#222" -}}{%- endif -%};background:{%- if config.tb_col.def_bg -%}{{- config.tb_col.def_bg -}}{%- else -%}{{- "#eee" -}}{%- endif -%}}.tag_cloud li a,h1,h2,h3,h4,h5,h6{color:{%- if config.tb_col.h_fg -%}{{- config.tb_col.h_fg -}}{%- else -%}{{- "#444" -}}{%- endif -%}}code,pre{color:{%- if config.tb_col.code_fg -%}{{- config.tb_col.code_fg -}}{%- else -%}{{- "#73001d" -}}{%- endif -%}}a,article.list h1:first-child,label[for=menu-icon]:hover,.four04,.p01-contact .required label:after,a>code{color:{%- if config.tb_col.a_fg -%}{{- config.tb_col.a_fg -}}{%- else -%}{{- "#003a73" -}}{%- endif -%}}code::selection,pre::selection{background:{%- if config.tb_col.code_fg -%}{{- config.tb_col.code_fg -}}{%- else -%}{{- "#73001d" -}}{%- endif -%};color:{%- if config.tb_col.box_bg -%}{{- config.tb_col.box_bg -}}{%- else -%}{{- "#ccc" -}}{%- endif -%}}::selection{background:{%- if config.tb_col.def_fg -%}{{- config.tb_col.def_fg -}}{%- else -%}{{- "#222" -}}{%- endif -%};color:{%- if config.tb_col.def_bg -%}{{- config.tb_col.def_bg -}}{%- else -%}{{- "#eee" -}}{%- endif -%}}.p01-contact input[type=submit]:not([type=radio]):not([type=checkbox]),.p01-contact input[type=button]:not([type=radio]):not([type=checkbox]){color:{%- if config.tb_col.def_bg -%}{{- config.tb_col.def_bg -}}{%- else -%}{{- "#eee" -}}{%- endif -%};background:{%- if config.tb_col.a_fg -%}{{- config.tb_col.a_fg -}}{%- else -%}{{- "#003366" -}}{%- endif -%}}#toc,code,pre,blockquote,kbd,aside,article.list:hover,input[type=checkbox]:checked~label,nav#menu-icon,input,textarea,select,.boxed{background:{%- if config.tb_col.box_bg -%}{{- config.tb_col.box_bg -}}{%- else -%}{{- "#ccc" -}}{%- endif -%}}blockquote,kbd,aside,pre,.border,input,textarea,select{border-color:{%- if config.tb_col.box_border -%}{{- config.tb_col.box_border -}}{%- else -%}{{- "#999" -}}{%- endif -%}}hr,details{border-color:{%- if config.tb_col.box2_bg -%}{{- config.tb_col.box2_bg -}}{%- else -%}{{- "#bbb" -}}{%- endif -%}}header,footer,.small span,input.submit{background:{%- if config.tb_col.box2_bg -%}{{- config.tb_col.box2_bg -}}{%- else -%}{{- "#bbb" -}}{%- endif -%}}input,textarea,select{color:{%- if config.tb_col.input_fg -%}{{- config.tb_col.input_fg -}}{%- else -%}{{- "#111" -}}{%- endif -%}}input:focus,textarea:focus,select:focus{border-color:{%- if config.tb_col.input_hi -%}{{- config.tb_col.input_hi -}}{%- else -%}{{- "#333" -}}{%- endif -%}}@media screen and (min-width:768px){nav#menu-icon{background:unset}}</style>
  23. {%- if meta.template == config.TableOfContent.template or not config.TableOfContent.template -%}
  24. {%- if meta.toc_alt -%}<link rel="stylesheet" href="{{- theme_url -}}/css/{{- meta.toc_alt -}}.css" type="text/css" />
  25. {%- else -%}<link rel="stylesheet" href="{{- theme_url -}}/css/TableOfContent.css" type="text/css" />
  26. {%- endif -%}
  27. {%- endif -%}
  28. {%- if meta.css_extra -%}<link rel="stylesheet" href="{{- theme_url -}}/css/{{- meta.css_extra -}}.css" type="text/css" />{%- endif -%}
  29. {%- if config.tagblog.custom_header -%}{%- include config.tagblog.custom_header -%}{%- endif -%}
  30. </head>
  31. <body>
  32. <header>
  33. <div class="inner flexbox">
  34. {%- include 'includes/topmenu.twig' ignore missing -%}
  35. {%- if config.tagblog.site_logo -%}<a href="{{- "index"|link -}}"><img src="{{- config.tagblog.site_logo -}}" alt="{{- site_title -}}"></a>{%- endif -%}
  36. <div class="title">
  37. <a href="{{- "index"|link -}}">{{- site_title -}}</a>
  38. </div>
  39. </div>
  40. </header>
  41. <div class="inner">
  42. <section id="sidebar">
  43. {# looping over all pages to pick out what we need (i.e. pages with tags) #}
  44. {%- set tag_count = {} -%} {# tag_count contains: tag : count of occurences #}
  45. {%- set tag_pages = {} -%} {# tag_pages contains: tag : page ids of occurences hash '#' separated #}
  46. {%- set aut_count = {} -%} {# aut_count contains: author : count of occurences #}
  47. {%- set aut_pages = {} -%} {# aut_pages contains: author : page ids of occurences hash '#' separated #}
  48. {%- set tbpages = {} -%} {# contains ALL pages to be considered, saves some cycles later on #}
  49. {%- for page in pages if page.meta.tags or page.meta.author -%}
  50. {%- if page.meta.tags -%}
  51. {%- set tbpages = tbpages|merge([page]) -%}
  52. {%- for tag in page.meta.tags|split(',') -%}
  53. {# tag_count contains: tag : count of occurences #}
  54. {%- set tag_count = tag_count|merge({(tag):(tag_count[tag] + 1)}) -%}
  55. {# tag_pages contains: tag : page ids of occurences hash '#' separated #}
  56. {%- set tag_pages = tag_pages|merge( { (tag) : (tag_pages[tag] ~ '#' ~ page.id) } ) -%}
  57. {%- endfor -%}
  58. {%- endif -%}
  59. {%- if page.meta.author -%}
  60. {%- set aut_count = aut_count|merge({(page.meta.author):(aut_count[page.meta.author] + 1)}) -%}
  61. {%- set aut_pages = aut_pages|merge({(page.meta.author):(aut_pages[page.meta.author]~'#'~page.id)}) -%}
  62. {%- endif -%}
  63. {%- endfor -%}
  64. {# sort tag_count into tag_sorting, according to config options #}
  65. {%- set tag_sorting = {} -%}
  66. {%- if config.tagblog.tagsort.method == 'numerical' -%}
  67. {%- set tag_sorting = tag_count|sort -%}
  68. {%- elseif config.tagblog.tagsort.method == 'alphabetical' -%}
  69. {%- for tag in tag_count|keys|sort -%}
  70. {%- set tag_sorting = tag_sorting|merge({(tag): tag_count[tag] }) -%}
  71. {%- endfor -%}
  72. {%- endif -%}
  73. {# ... and sort it back into tag_count array #}
  74. {%- if config.tagblog.tagsort.reverse -%}
  75. {%- set tag_count = tag_sorting|reverse -%}
  76. {%- else -%}
  77. {%- set tag_count = tag_sorting -%}
  78. {%- endif -%}
  79. <input id="menu-icon" type="checkbox"/>
  80. {# There used to be a fontawesome-kindof hamburger icon here, and a span besides it - but less is more #}
  81. <label for="menu-icon">Menu</label>
  82. <nav id="menu-icon"> {# this nav's visibility is controled by the checkbox above! (mobile only) #}
  83. {%- include 'includes/sidebar-top.twig' ignore missing -%}
  84. {# Tag List #}
  85. {%- if config.tagblog.taglist.enabled and tag_count -%}
  86. <div class="tag_list">
  87. {%- if config.tagblog.taglist.title -%}<h2>{{- config.tagblog.taglist.title -}}</h2>{%- endif -%}
  88. <ul>
  89. {%- for tag,total in tag_count -%}
  90. <li>
  91. <a href="/tags?q={{- tag -}}">{{- tag -}}{%- if config.tagblog.tagcount.enabled -%}<span> ({{- total -}})</span>{%- endif -%}</a>
  92. </li>
  93. {%- endfor -%}
  94. </ul>
  95. </div>
  96. {%- endif -%}
  97. {# Tag Cloud #}
  98. {%- if config.tagblog.tagcloud.enabled and tag_count -%}
  99. {# Levels Validation #}
  100. {%- if max(tag_count) < config.tagblog.tagcloud.maxoccur -%}
  101. {%- set tagmaxoccur = max(tag_count) -%}
  102. {%- else -%}
  103. {%- set tagmaxoccur = config.tagblog.tagcloud.maxoccur -%}
  104. {%- endif -%}
  105. {# Render Tag Cloud #}
  106. <div class="tag_cloud">
  107. {%- if config.tagblog.tagcloud.title -%}<div>{{- config.tagblog.tagcloud.title -}}</div>{%- endif -%}
  108. <ul>
  109. {%- for tag,total in tag_count -%}
  110. {%- if total > tagmaxoccur -%}{%- set size = tagmaxoccur -%}{%- else -%}{%- set size = total -%}
  111. {%- endif -%}
  112. {%- if size == 1 -%}{%- set fontsize = config.tagblog.tagcloud.fontsizemin -%}
  113. {%- else -%}
  114. {# calculate tag font size - https://stackoverflow.com/a/3717340 #}
  115. {%- set fontsize = ( (size / tagmaxoccur) * ( config.tagblog.tagcloud.fontsizemax - config.tagblog.tagcloud.fontsizemin ) + config.tagblog.tagcloud.fontsizemin ) -%}
  116. {%- endif -%}
  117. <li style="font-size:{{- fontsize -}}rem;">
  118. <a href="/tags?q={{- tag -}}">{{- tag -}}{%- if config.tagblog.tagcount.enabled -%}<span>{{- total -}}</span>{%- endif -%}</a></li>
  119. {%- endfor -%}
  120. </ul>
  121. </div>
  122. {%- endif -%}
  123. <hr />
  124. <div class="clearfix">
  125. {%- if config.tagblog.search.enabled -%}
  126. {# searches go to the /search.md page #}
  127. <form class="search paragraph" id="search_form" action="/search">
  128. {# <label for="search_input">Search» </label> #}
  129. <span><input title='{{ search_tooltip }}' class="submit" type="submit" value="Search" /></span>
  130. <span><input pattern=".{0{{- config.tagblog.search.minlength -}},}" required title="{{- config.tagblog.search.minlength -}} characters minimum" size="15" type="text" id="search_input" name="q" /></span>
  131. </form>
  132. {%- endif -%}
  133. {%- if config.tagblog.feed.enabled -%}
  134. <div class="rss paragraph"><a href="/feed">RSS Feed</a></div>
  135. {%- endif -%}
  136. {%- include 'includes/sidebar-bottom.twig' ignore missing -%}
  137. </div>
  138. </nav>
  139. </section>
  140. <section id="content">
  141. {%- block content -%}
  142. {%- set count = tbpages|length -%}
  143. <h3>All Articles ({{- count -}})</h3>
  144. {%- set paging_url_base = current_page.url ~ '?' -%}
  145. {%- set paging_array = tbpages -%}
  146. {%- include 'includes/paging.twig' -%}
  147. {%- endblock -%}
  148. </section>
  149. </div>
  150. <footer>
  151. {%- include 'includes/footer.twig' ignore missing -%}
  152. </footer>
  153. </body>
  154. <!-- made with tagblog version 2020-09-26 -->
  155. </html>{%- endapply -%}