diff options
| author | Jieiku | 2023-09-20 00:25:21 -0700 |
|---|---|---|
| committer | Jieiku | 2023-09-20 00:25:21 -0700 |
| commit | 08f406c44c861a914c8b63fab454250f8a4c4b36 (patch) | |
| tree | a636aa28e60b6b110138b378996ee2523c1e7bf0 | |
| parent | b1be7cc6de3737ebbb1ae1485652e32a2888dbfc (diff) | |
| download | abridge-08f406c44c861a914c8b63fab454250f8a4c4b36.tar.gz abridge-08f406c44c861a914c8b63fab454250f8a4c4b36.tar.bz2 abridge-08f406c44c861a914c8b63fab454250f8a4c4b36.zip | |
refactor nav, blocks, macros, templates. fix image shortcodes
42 files changed, 703 insertions, 710 deletions
diff --git a/COPY-TO-ROOT-SASS/_extra.scss b/COPY-TO-ROOT-SASS/_extra.scss new file mode 100644 index 0000000..42d9392 --- /dev/null +++ b/COPY-TO-ROOT-SASS/_extra.scss @@ -0,0 +1,3 @@ +/****************************************************************************** + * Extra - Put your extra SASS/CSS here, it will get bundled with abridge.css + *****************************************************************************/ diff --git a/COPY-TO-ROOT-SASS/abridge.scss b/COPY-TO-ROOT-SASS/abridge.scss index b494965..5b64dd1 100644 --- a/COPY-TO-ROOT-SASS/abridge.scss +++ b/COPY-TO-ROOT-SASS/abridge.scss @@ -182,13 +182,13 @@ //$form: true,//Form elements (non-button) //$top: true,//back to top button using CSS //$search: true,//search feature - //$toc: true,//Table of Contents, page index / recent posts block - //$series: true,//Allows for posts to display in a series - //$modifiers: true,//tiny modifier classes for sizing and spacing + //$blocks: true,//css classes for block formatting, eg: recent posts, table of contents, series navigation + //$modifiers: true,//tiny modifier classes for sizing, spacing, etc. //$misc: false, - //$grid: false,//Infinity Grid, column based layouts. + //$grid: true,//Infinity Grid, column based layouts. //$syntax: true,//syntax highlighting for code blocks ); +@use "extra"; /****************************************************************************** * FONTS - Abridge by default uses the System Font Stack * https://css-tricks.com/snippets/css/system-font-stack/ diff --git a/config.toml b/config.toml index aeed1f6..8ff9621 100644 --- a/config.toml +++ b/config.toml @@ -61,6 +61,7 @@ Index = "Indice" Powered_by = "Propulsé" and = "et" About = "Sur" +Blog = "Blog" Posts = "Articles" Categories = "Catégories" Tags = "Mots-clés" @@ -96,15 +97,16 @@ flag.fr = "🇫🇷" ############################################################################### ### Layout & Format ### position: top, bottom, both, false(hidden) -### size: s95, s90, s85, s80, s75, s70, false(full size) +### size: s150, s140, s130, s120, s110, s95, s90, s85, s80, s75, s70, false(full size) ### divider: " " "·" "•" ############################################################################### menu = [ - {url = "about", name = "About", slash = true, blank = false}, - {url = "archive", name = "Posts", slash = true, blank = false}, -# {url = "categories", name = "Categories", slash = true, blank = false}, - {url = "tags", name = "Tags", slash = true, blank = false}, +# {url = "blog", name = "Blog", slash = true, blank = false, size="s110"}, + {url = "about", name = "About", slash = true, blank = false, size="s110"}, + {url = "archive", name = "Posts", slash = true, blank = false, size="s110"}, +# {url = "categories", name = "Categories", slash = true, blank = false, size="s110"}, + {url = "tags", name = "Tags", slash = true, blank = false, size="s110"}, ] menu_footer = [ {url = "about", name = "About", slash = true, blank = false}, @@ -113,16 +115,20 @@ menu_footer = [ {url = "sitemap.xml", name = "Sitemap", slash = false, blank = true}, ] +toc = true recent = true # TOC / index recent_items = 15 +series = true +#Series_parts = "$NUMBER_OF_PARTS part Series" + -meta_index = { position="bottom", size="s90", author=false, readtime=false, readstring="min", date=true, updated=false, categories_tags=true, divider=" " } -meta_post = { position="top", size="s95", author=true, readtime=false, readstring="min read", date=true, updated=true, categories_tags=true, divider=" " } +meta_index = { position="bottom", size="s90", author=false, readtime=false, readstring="min", date=true, updated=false, categories_tags=true, divider=""} +meta_post = { position="top", size="s95", author=true, readtime=false, readstring="min read", date=true, updated=true, categories_tags=true, divider=""} hide_section_dates = false # hides the date for sections that use posts.html as their template. hide_page_nextprev_titles = false # hides the next/previous titles for pages that use page.html as their template. -title_size_index = "s85" # size: s95, s90, s85, s80, s75, s70, false(full size) -footer_size = "s90" # size: s95, s90, s85, s80, s75, s70, false(full size) +title_size_index = "s85" +footer_size = "s90" footer_credit = true #footer_credit_override = '<p class="s90">Powered by <a href="https://www.getzola.org/" target="_blank">Zola</a> & <a href="https://github.com/Jieiku/abridge/" target="_blank">Abridge</a></p>' #archive_reverse = true # Set to True to sort posts chronologically per year instead of newest first on the archive page: example.com/archive/ diff --git a/content/_index.fr.md b/content/_index.fr.md index 3511f76..a31a970 100644 --- a/content/_index.fr.md +++ b/content/_index.fr.md @@ -1,4 +1,5 @@ +++ paginate_by = 3 sort_by = "date" +template = "index.html" +++ diff --git a/content/_index.md b/content/_index.md index 3511f76..a31a970 100644 --- a/content/_index.md +++ b/content/_index.md @@ -1,4 +1,5 @@ +++ paginate_by = 3 sort_by = "date" +template = "index.html" +++ diff --git a/content/archive/_index.fr.md b/content/archive/_index.fr.md index b1a35cf..6234b9b 100644 --- a/content/archive/_index.fr.md +++ b/content/archive/_index.fr.md @@ -1,3 +1,6 @@ +++ template = "archive.html" + +[extra] +sec = "blog" +++ diff --git a/content/archive/_index.md b/content/archive/_index.md index b1a35cf..6234b9b 100644 --- a/content/archive/_index.md +++ b/content/archive/_index.md @@ -1,3 +1,6 @@ +++ template = "archive.html" + +[extra] +sec = "blog" +++ diff --git a/content/blog/_index.fr.md b/content/blog/_index.fr.md new file mode 100644 index 0000000..a31a970 --- /dev/null +++ b/content/blog/_index.fr.md @@ -0,0 +1,5 @@ ++++ +paginate_by = 3 +sort_by = "date" +template = "index.html" ++++ diff --git a/content/blog/_index.md b/content/blog/_index.md new file mode 100644 index 0000000..a31a970 --- /dev/null +++ b/content/blog/_index.md @@ -0,0 +1,5 @@ ++++ +paginate_by = 3 +sort_by = "date" +template = "index.html" ++++ diff --git a/content/images/_index.md b/content/images/_index.md new file mode 100644 index 0000000..800a244 --- /dev/null +++ b/content/images/_index.md @@ -0,0 +1,3 @@ ++++ +render = false ++++ diff --git a/content/overview-rich-content/ferris-gesture.svg b/content/images/ferris-gesture.svg index d819588..d819588 100644 --- a/content/overview-rich-content/ferris-gesture.svg +++ b/content/images/ferris-gesture.svg diff --git a/content/overview-rich-content/ferris.svg b/content/images/ferris.svg index 1409b10..1409b10 100644 --- a/content/overview-rich-content/ferris.svg +++ b/content/images/ferris.svg diff --git a/content/overview-abridge/index.fr.md b/content/overview-abridge/index.fr.md index b4f84e6..3f307bc 100644 --- a/content/overview-abridge/index.fr.md +++ b/content/overview-abridge/index.fr.md @@ -11,8 +11,6 @@ tags = ["Features","Config"] toc = true +++ -A fast, lightweight, and modern [Zola](https://getzola.org) theme utilizing [abridge.css](https://github.com/Jieiku/abridge.css) (a class-light semantic HTML CSS Framework). Perfect [Lighthouse](https://pagespeed.web.dev/report?url=abridge.netlify.app), [YellowLabTools](https://yellowlab.tools/), and [Observatory](https://observatory.mozilla.org/analyze/abridge.netlify.app) scores. Here is a [Zola Themes Benchmarks](https://github.com/Jieiku/zola-themes-benchmarks/blob/main/README.md) Page. - Un thème [Zola](https://getzola.org) rapide, léger et moderne utilisant [abridge.css](https://github.com/Jieiku/abridge.css) (un framework HTML CSS sémantique léger en classe ). Scores parfait [Lighthouse](https://pagespeed.web.dev/report?url=abridge.netlify.app), [YellowLabTools](https://yellowlab.tools/) et [Observatory](https://observatory.mozilla.org/analyze/abridge.netlify.app). Voici une page [Zola Themes Benchmarks](https://github.com/Jieiku/zola-themes-benchmarks/blob/main/README.md). <!-- more --> diff --git a/content/overview-images/index.fr.md b/content/overview-images/index.fr.md index 8504e8a..96c899c 100644 --- a/content/overview-images/index.fr.md +++ b/content/overview-images/index.fr.md @@ -47,13 +47,13 @@ Cet article couvre les **shortcodes imgswap et img**. Les images peuvent égalem ## Utilisation (chemin racine /) ```rs -{{/* img(src="/overview-rich-content/ferris.svg" alt="Ferris le Rustacé") */}} +{{/* img(src="/images/ferris.svg" alt="Ferris le Rustacé") */}} ``` **Sortir** ```html -{{ img(src="/overview-rich-content/ferris.svg" alt="Ferris le Rustacé") }} +{{ img(src="/images/ferris.svg" alt="Ferris le Rustacé") }} ``` -{{ img(src="/overview-rich-content/ferris.svg" alt="Ferris le Rustacé") }} +{{ img(src="/images/ferris.svg" alt="Ferris le Rustacé") }} # Image SVG directement dans le code ```html @@ -99,10 +99,10 @@ Lorsque vous passez votre souris sur l'image, l'image à comparer s'affiche. ## Utilisation (chemin racine /) ```rs -{{/* imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg") */}} +{{/* imgswap(main_src="/images/ferris.svg" swap_src="/images/ferris-gesture.svg") */}} ``` **Sortir** ```html -{{ imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg") }} +{{ imgswap(main_src="/images/ferris.svg" swap_src="/images/ferris-gesture.svg") }} ``` -{{ imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg") }} +{{ imgswap(main_src="/images/ferris.svg" swap_src="/images/ferris-gesture.svg") }} diff --git a/content/overview-images/index.md b/content/overview-images/index.md index ed430db..6c515cd 100644 --- a/content/overview-images/index.md +++ b/content/overview-images/index.md @@ -47,13 +47,13 @@ This post covers the **imgswap and img shortcodes**. Images can also be embedded ## Usage (root path /) ```rs -{{/* img(src="/overview-rich-content/ferris.svg" alt="Ferris the Rustacean") */}} +{{/* img(src="/images/ferris.svg" alt="Ferris the Rustacean") */}} ``` **Output** ```html -{{ img(src="/overview-rich-content/ferris.svg" alt="Ferris the Rustacean") }} +{{ img(src="/images/ferris.svg" alt="Ferris the Rustacean") }} ``` -{{ img(src="/overview-rich-content/ferris.svg" alt="Ferris the Rustacean") }} +{{ img(src="/images/ferris.svg" alt="Ferris the Rustacean") }} # SVG image directly in code ```html @@ -99,10 +99,10 @@ When you hover your mouse over the image it will display the image to compare. ## Usage (root path /) ```rs -{{/* imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg") */}} +{{/* imgswap(main_src="/images/ferris.svg" swap_src="/images/ferris-gesture.svg") */}} ``` **Output** ```html -{{ imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg") }} +{{ imgswap(main_src="/images/ferris.svg" swap_src="/images/ferris-gesture.svg") }} ``` -{{ imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg") }} +{{ imgswap(main_src="/images/ferris.svg" swap_src="/images/ferris-gesture.svg") }} diff --git a/content/overview-math.fr.md b/content/overview-math.fr.md index e24b4e6..7097702 100644 --- a/content/overview-math.fr.md +++ b/content/overview-math.fr.md @@ -1,5 +1,5 @@ +++ -title = "Notations mathématiques" +title = "Notation mathématiques" description = "Exemple d'article présentant l'affichage des notations mathématiques, rendu possible par la bibliothèque KaTeX." date = 2021-05-05 updated = 2022-01-01 diff --git a/content/overview-math.md b/content/overview-math.md index c34d2f2..446f537 100644 --- a/content/overview-math.md +++ b/content/overview-math.md @@ -1,5 +1,5 @@ +++ -title = "Mathematical Notations" +title = "Mathematical Notation" description = "Sample article showcasing the display of Mathematical Notations, made possible by the KaTeX library." date = 2021-05-05 updated = 2022-01-01 diff --git a/content/pages/contact.fr.md b/content/pages/contact.fr.md index cae2626..27ad163 100644 --- a/content/pages/contact.fr.md +++ b/content/pages/contact.fr.md @@ -2,6 +2,26 @@ title = "Contact" description = "Pour nous joindre, veuillez utiliser le formulaire de contact sur cette page." path = "fr/contact" -template = "contact.fr.html" +template = "pages.html" draft = false +++ + +<p>Vous voulez entrer en contact ? Remplissez le formulaire ci-dessous pour m'envoyer un message et je vous répondrai dans les plus brefs délais !</p> +<form name="contact" method="POST"> + <p> + <label for="name">Nom</label> + <input type="text" placeholder="Nom" id="name" required data-validation-required-message="S'il vous plaît entrez votre nom." /> + </p> + <p> + <label for="email">Adresse e-mail</label> + <input type="email" placeholder="nom@example.com" id="email" required data-validation-required-message="Veuillez saisir votre adresse e-mail." /> + </p> + <p> + <label for="message">Message</label> + <textarea rows="5" placeholder="Message" id="message" required data-validation-required-message="Veuillez entrer un message."></textarea> + </p> + <div id="success"></div> + <p> + <button type="submit" id="sendMessageButton">Envoyer</button> + </p> +</form> diff --git a/content/pages/contact.md b/content/pages/contact.md index 306b360..a16ed7e 100644 --- a/content/pages/contact.md +++ b/content/pages/contact.md @@ -2,6 +2,26 @@ title = "Contact" description = "To reach us please use the contact form on this page." path = "contact" -template = "contact.html" +template = "pages.html" draft = false -+++
\ No newline at end of file ++++ + +<p>Want to get in touch? Fill out the form below to send me a message and I will get back to you as soon as possible!</p> +<form name="contact" method="POST"> + <p> + <label for="name">Name</label> + <input type="text" placeholder="Name" id="name" required data-validation-required-message="Please enter your name." /> + </p> + <p> + <label for="email">Email Address</label> + <input type="email" placeholder="name@example.com" id="email" required data-validation-required-message="Please enter your email address." /> + </p> + <p> + <label for="message">Message</label> + <textarea rows="5" placeholder="Message" id="message" required data-validation-required-message="Please enter a message."></textarea> + </p> + <div id="success"></div> + <p> + <button type="submit" id="sendMessageButton">Send</button> + </p> +</form> diff --git a/content/pages/privacy.md b/content/pages/privacy.md index 52bfc01..1b7eec5 100644 --- a/content/pages/privacy.md +++ b/content/pages/privacy.md @@ -12,4 +12,4 @@ draft = false - This site does not store data in the browser to be shared, sent, or sold to third-parties. - No personal information is shared, sent, or sold to third-parties. -**Effective Date:** _1st Jan 2022_
\ No newline at end of file +**Effective Date:** _1st Jan 2022_ diff --git a/sass/abridge.scss b/sass/abridge.scss index 14a691b..d844403 100644 --- a/sass/abridge.scss +++ b/sass/abridge.scss @@ -211,13 +211,13 @@ $button: true !default;//Form elements (button) $form: true !default;//Form elements (non-button) $top: true !default;//back to top button using CSS $search: true !default;//search feature -$toc: true !default;//Table of Contents, page index / recent posts block +$blocks: true !default;//css classes for block formatting, eg: recent posts, table of contents, series navigation $modifiers: true !default;//tiny modifier classes for sizing and spacing $imgswap: true !default;//Image Swap on hover/click $misc: false !default; -$grid: false !default;//Infinity Grid, column based layouts. +$grid: true !default;//Infinity Grid, column based layouts. $syntax: true !default;//syntax highlighting for code blocks -$series: true !default;//series of posts + /****************************************************************************** * Root element @@ -440,8 +440,7 @@ $series: true !default;//series of posts h6 { padding-left: 0; color: var(--f2); - margin-bottom: var(--s1); - margin-top: var(--s2); + margin: var(--s2) 0 var(--s1); font-weight: var(--fh); font-size: var(--fs); line-height: var(--lhh); @@ -473,7 +472,7 @@ $series: true !default;//series of posts color: var(--a2); text-decoration: underline; } - h1 a, h2 a, a.si, main nav a, nav > div > a { + h1 a, h2 a, main nav a, header span > a { color: var(--f2); text-decoration: none; font-weight: var(--fh); @@ -545,7 +544,7 @@ $series: true !default;//series of posts color: var(--f1); font-style: normal; font-weight: var(--fw); - font-size: var(--fs); + //font-size: var(--fs);//TODO: This caused the lists to be a different size than the rest of the page, it was quite jarring } // Lists @@ -657,29 +656,71 @@ $series: true !default;//series of posts } } @if $nav { - //https://github.com/raj457036/attriCSS - .on, - .on:visited {//pagination link styling - font-weight: var(--fh); - border: .1rem solid var(--c4); - border-radius: var(--br); - padding: .1rem var(--s1); + header > nav > div {//padding above nav divs in header + padding-top: var(--s2); } - .on:hover {//makes border of pagination links hover color - border-color: var(--a3); - .svgh { - background: var(--a3); - opacity: 1; + footer > div {//padding above social icons + padding-top: var(--s1); + } + header > nav, header > nav > div:nth-child(2) { + display: flex; + flex-direction: column; + flex-wrap: wrap; + justify-content: space-between; + align-items: center; + //margin: 0 auto; + h1 { + margin: 0;//right margin + } + span { + display: flex; + flex-wrap: wrap; + justify-content: center; + align-items: center; } } - nav > div > a, header i, header .dropdown { - margin-right: .2rem; - vertical-align: middle; + + header > nav > div:nth-child(2) {//puts logo on left and menu/search on right + margin-left: auto; + justify-content: center; + a, i, .dropdown { + margin: 0 var(--s2) 0 0;//right margin + } + } + // mobile first layout. + header nav { + margin: var(--s1) auto 0; // keeps top menu/search centered in mobile view + flex-direction: column;// column layout for mobile view + div:nth-child(2) { + margin: auto; // keeps top menu/search centered in mobile view + } + } + nav { + align-items: center; + justify-content: center;//center pagination horizontally + display: flex; + } + + //dropdown menu used for lang, etc. + .dropdown { + display: inline-block; + position: relative; + z-index: 99; font-weight: var(--fh); + font-size: 1.4rem; } - main nav {//pagination - a,span { - margin: .2rem; + .dropdown-content { + display: none; + position: absolute; + z-index: 99; + font-weight: var(--fh); + font-size: 1.4rem; + } + .dropdown:hover .dropdown-content { + display: block; + z-index: 99; + a { + text-decoration: none; } } article nav {//prev/next page title @@ -687,7 +728,6 @@ $series: true !default;//series of posts text-align: right; } } - //footer nav > footer nav { a { margin: .2rem; @@ -696,46 +736,28 @@ $series: true !default;//series of posts margin-bottom: .2rem; } } - header > nav > div:first-of-type {//Keep the logo from wrapping - display: inline; - min-width: fit-content; - padding-right: var(--s1);//add some spacing between nav divs - } - header > nav > div:nth-child(2) {//puts logo on left and menu/search on right - margin-left: auto; - padding-right: var(--s1);//add some spacing between nav divs - } - // mobile first layout. - header nav { - flex-direction: column;// column layout for mobile view - h1 { - margin: var(--s2) 0 var(--s1);//adds more padding above for mobile view - } - div { - margin: auto; // keeps top menu/search centered in mobile view + + //pagination + main nav { + margin-top: var(--s2);//pagination margin + a,span { + margin: .2rem; } } - nav > div { - margin: var(--s1) 0; + .on, + .on:visited {//pagination link styling + font-weight: var(--fh); + border: .1rem solid var(--c4); + border-radius: var(--br); + padding: .1rem var(--s1); } - nav { - align-items: center; - justify-content: center;//center pagination horizontally - display: flex; - div h2 { - font-size: 1rem; - &:hover { - color: var(--a3); - } - } - h1 { - margin-bottom: 0; - margin-top: 0.2rem; + .on:hover {//makes border of pagination links hover color + border-color: var(--a3); + .svgh { + background: var(--a3); + opacity: 1; } } - main nav { - margin-top: var(--s2);//pagination margin - } .outp { padding: 0 .26rem .2rem; } @@ -757,40 +779,17 @@ $series: true !default;//series of posts .mode:hover, .cnav { color: var(--a1);//pagination color current page } - //dropdown menu used for lang, etc. - .dropdown { - display: inline-block; - position: relative; - z-index: 99; - font-weight: var(--fh); - font-size: 1.4rem; - } - .dropdown-content { - display: none; - position: absolute; - z-index: 99; - font-weight: var(--fh); - font-size: 1.4rem; - } - .dropdown:hover .dropdown-content { - display: block; - z-index: 99; - a { - text-decoration: none; - } - } + // breakpoint makes header responsive for desktop layouts // mobile first is min-width for desktop instead of max-width for mobile @if map-get($breakpoints, "md") { @media (min-width: map-get($breakpoints, "md")) { - header > nav > div { - margin: var(--s1) 0;// desktop layout - } - header nav { + header nav, header > nav > div:nth-child(2) { flex-direction: row;// row layout for desktop view - h1 { - margin: var(--s1) 0;// desktop layout - } + margin: 0 0 0 auto;// desktop layout + } + header > nav > div { + padding-top: var(--s1); } } } @@ -1153,7 +1152,7 @@ $series: true !default;//series of posts @if map-get($breakpoints, "md") { @media (min-width: map-get($breakpoints, "md")) { .searchd > input { - max-width: 15.3rem; + max-width: 15rem; flex-grow: 0; } #suggestions { @@ -1165,52 +1164,49 @@ $series: true !default;//series of posts } } } -@if $toc { - main { - .toc { - max-width: 15rem; - min-width: 14rem; - margin-left: var(--s1); - } - .toc-item { - padding: .4rem 0 0; - color: var(--f1); - } - .toc-item a, .toc-item-child a { - color: var(--f1); - &:hover { - cursor: pointer; - color: var(--a2); - text-decoration: underline; - } - } - .toc-item a.active, .toc-item-child a.active { - color: var(--a2); - } - .toc-item-child { - padding: 0 var(--s1); - color: var(--f1); - } +@if $blocks { + .block { + max-width: 30rem; + margin: var(--s2) auto; } - .toc { - display: none; + .sblock { + max-width: 15rem; + min-width: 14rem; + margin-left: var(--s1); } - .toc-sticky { + .blockdiv { border-radius: var(--br); border-top: 5px solid var(--a1); background-color: var(--c2); - position: sticky; - top: var(--s2); margin-top: var(--s2); padding: 0 var(--s2) var(--s2); max-height: 100vh; overflow: auto; + a { + color: var(--f1); + &:hover { + color: var(--a2); + } + } + ol { + margin: 0; + } + } + .sticky { + position: sticky; + top: var(--s2); + } + .sblock { + display: none;//hide in mobile view } @if map-get($breakpoints, "md") { // mobile first is min-width for desktop instead of max-width for mobile @media (min-width: map-get($breakpoints, "md")) { - .toc { - display: unset; + .sblock { + display: unset;//show in desktop view + } + .block { + display: none;//hide in desktop view, TODO: depending on what blocks get used for, this could be a problem in the future, should be fine for now. } } } @@ -1247,18 +1243,25 @@ $series: true !default;//series of posts @if $grid { // https://github.com/vladocar/Basic.css [style*="--c:"], section>section { + flex: var(--c,1); + margin: var(--s1); color: var(--f2); padding: var(--s1); - margin: var(--s1); text-align: center; } section { display: flex; flex-flow: row wrap; - } - [style*="--c:"], section>section { - flex:var(--c,1); - margin:var(--s1); + article { + div { + text-align: center; + } + h1, h2, h3 { + text-align: center; + } + padding: 20px 30px; + min-width: 340px;// limits to 3 columns wide, TODO: solution to limit number of columns + } } } @if $enable-icons { @@ -1345,15 +1348,21 @@ $series: true !default;//series of posts } @if $modifiers { .sum, .sum p {margin: .2rem 0} + .s150 {font-size: 1.5em} + .s140 {font-size: 1.4em} + .s130 {font-size: 1.3em} + .s120 {font-size: 1.2em} + .s110 {font-size: 1.1em} .s95 {font-size: .95em} .s90 {font-size: .90em} .s85 {font-size: .85em} .s80 {font-size: .80em} .s75 {font-size: .75em} .s70 {font-size: .70em} - .hpad {padding: 0 .2rem} - .rpad {padding-right: .2rem} - .si {font-size: 1.5em} + .hpad {padding: 0 var(--s1)} + .rpad {padding-right: var(--s1)} + .tpad {padding-top: var(--s1)} + .b {font-weight: var(--fh)} } @if $syntax { // Unstyled Text Color, and background color @@ -1555,65 +1564,3 @@ $series: true !default;//series of posts // color: var(--h1); //} } - -@if $series { - .series-mobile { - max-width: 30rem; - margin: var(--s2) auto; - border-radius: var(--br); - background-color: var(--c2); - } - - .series { - background-color: var(--c2); - max-height: 100vh; - padding: 0 var(--s2) var(--s2); - border-radius: var(--br); - border-top: 5px solid var(--a1); - overflow: auto; - } - - .series h4 a { - color: var(--f1); - font-weight: 700; - &:hover { - color: var(--a3); - } - } - - .series ol { - margin: 0; - } - - .series ol a { - color: var(--f1); - &:hover { - color: var(--a2); - text-decoration: underline; - } - } - - .series li { - font-size: .875rem; - } -} - -@if $series and $toc { - .series-toc { - margin-top: var(--s2); - max-height: 100vh; - } - - @if map-get($breakpoints, "md") { - // mobile first is min-width for desktop instead of max-width for mobile - @media (min-width: map-get($breakpoints, "md")) { - .series-mobile { - display: none; - } - } - } -} - -.toc h1 { - margin: 0; -}
\ No newline at end of file diff --git a/templates/404.html b/templates/404.html index 7b7c325..07f32b3 100644 --- a/templates/404.html +++ b/templates/404.html @@ -14,7 +14,7 @@ {%- set description = config.description %} - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description, is_404=true) }} + {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_404=true) }} {%- endblock seo %} {%- block content %} diff --git a/templates/archive.html b/templates/archive.html index 8ac3cfc..e4f7e06 100644 --- a/templates/archive.html +++ b/templates/archive.html @@ -19,13 +19,17 @@ This Template can also be used as the rendering template for Sections, eg: examp {%- set description = config.description %} - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} + {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} {%- endblock seo %} {%- block content %} {#- The following line is checking if the template is being used for the archive page or a section #} {%- if current_path is matching("^(/[[:alpha:]][[:alpha:]])?/archive/$") %} - {%- set sec = "" %} + {%- if section.extra.sec %} + {%- set sec = section.extra.sec ~ "/" %} + {%- else %} + {%- set sec = "" %} + {%- endif %} {%- else %} {%- set langpath = "/" %} {%- if lang != config.default_language %} diff --git a/templates/base.html b/templates/base.html index 8d85516..b3dfec8 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,21 +1,13 @@ -{%- import 'macros/head.html' as macros_head %} -{%- import "macros/social.html" as social_macros %} -{%- import "macros/page.html" as page_macros %} +{%- import 'macros/seo.html' as macros_seo %} {%- import "macros/macros.html" as macros %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} <!DOCTYPE html> <html lang="{%- if lang != config.default_language %}{{ lang }}{% else %}{{ config.extra.language_code | default(value=lang) }}{% endif %}"> <head> - {{- macros_head::theme(config=config) }} - {{- macros_head::stylesheets(config=config) }} - <meta charset="utf-8" /> - <meta http-equiv="x-ua-compatible" content="ie=edge" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - {{- macros_head::stylesheets_preload(config=config) }} - {{- macros_head::js(config=config) }} - <meta name="base" content="{{ config.base_url | safe }}" /> - {{- macros_head::feed(config=config) }} + {%- include "partials/head.html" %} + + {#- SEO: title, description, etc #} {%- block seo %} {%- if config.extra.title_separator %} {%- set title_separator = " " ~ config.extra.title_separator ~ " " -%} @@ -23,15 +15,11 @@ {%- set title_separator = " | " -%} {%- endif %} {%- endblock seo %} - <meta name="HandheldFriendly" content="True" /> - <meta name="mobile-web-app-capable" content="yes" /> - <meta name="apple-mobile-web-app-capable" content="yes" /> - <meta name="apple-mobile-web-app-status-bar-style" content="default" /> - {{- macros_head::security(config=config) }} - {{- macros_head::favicons(config=config) }} + {%- block comments_init %} {%- endblock comments_init %} - <noscript><link rel="stylesheet" href="{{ get_url(path='nojs.css', trailing_slash=false) | safe }}" /></noscript> + + {%- include "partials/head_js.html" %} </head> <body> {%- block header %} @@ -39,7 +27,7 @@ <nav> <div> {%- if config.extra.logo -%} - <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls %}/index.html{%- endif %}"> + <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls %}/index.html{%- endif %}" title="{{config.title}}"> {%- if config.extra.logo.file -%} <img src="{{ config.base_url | safe }}/{{ config.extra.logo.file | safe }}"{%- if config.extra.logo.alt %} alt="{{ config.extra.logo.alt | safe }}"{%- endif %}{%- if config.extra.logo.width %} width="{{ config.extra.logo.width | safe }}"{%- endif %}{%- if config.extra.logo.height %} height="{{ config.extra.logo.height | safe }}"{%- endif %} /> {%- endif -%} @@ -48,56 +36,65 @@ {%- elif config.extra.textlogo -%} <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls -%} {%- if lang == config.default_language -%}/{%- endif -%} - index.html{%- endif -%}">{{ config.extra.textlogo | safe }}</a></h1> + index.html{%- endif -%}" title="{{config.title}}">{{ config.extra.textlogo | safe }}</a></h1> {%- elif config.title -%} - <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls %}/index.html{%- endif %}">{{ config.title | safe }}</a></h1> + <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls %}/index.html{%- endif %}" title="{{config.title}}">{{ config.title | safe }}</a></h1> {%- endif -%} </div> <div> - {% set js_switcher=config.extra.js_switcher | default(value=true) %} - {%- if config.extra.menu or js_switcher %} - {%- if config.extra.menu %} - {%- for i in config.extra.menu -%} - <a href="{{ get_url(path=i.url, lang=lang, trailing_slash=i.slash) }}{%- if i.slash and uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}> - {%- if lang != config.default_language %} {{ trans(key=i.name | safe, lang=lang) }} {% else %} {{ i.name | safe }} {% endif -%} - </a> - {%- endfor -%} - {%- endif -%} - {%- if js_switcher -%} - {%- set icon_adjust=config.extra.icon_adjust | default(value="svgs adjust") -%} - {%- if icon_adjust -%}<i type="reset" id="mode" class="js {{ icon_adjust }}"></i>{%- else -%}<i type="reset" id="mode" class="js mode">☀</i>{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- if config.languages | length > 0 %} - <div class="dropdown" type="Button"> {%- if lang != config.default_language %}{{ trans(key="flag" | safe, lang=lang) }}{% else %}{{ config.extra.flag.en }}{% endif %} - {%- if current_url %} - <div class="dropdown-content"> - {%- for lcode,flag in config.extra.flag -%} - {%- if lang != lcode -%} - {%- if lcode == config.default_language -%} - <a type="Button" href="{{ current_url | replace(from=current_path | truncate(length=4, end=""), to="/") | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> - {%- else -%} - <a type="Button" href="{{ current_url | replace(from=config.base_url, to=config.base_url ~ "/" ~ lcode) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> - {%- endif -%} - {%- endif -%} - {%- endfor -%} + <div> + <span> + {% set js_switcher=config.extra.js_switcher | default(value=true) %} + {%- if config.extra.menu or js_switcher %} + {%- if config.extra.menu %} + {%- for i in config.extra.menu -%} + + + + <a{%- if i.size %} class="{{ i.size }}"{% endif %} href="{%- if i.url is matching("^http[s]?://") %}{{ i.url }}{%- else -%}{{ get_url(path=i.url, lang=lang, trailing_slash=i.slash) }}{%- if i.slash and uglyurls %}index.html{%- endif %}{%- endif %}"{% if i.blank %} target="_blank"{% endif %}> + {%- if lang != config.default_language %} {{ trans(key=i.name | safe, lang=lang) }} {% else %} {{ i.name | safe }} {% endif -%} + </a> + {%- endfor -%} + {%- endif -%} + {%- if js_switcher -%} + {%- set icon_adjust=config.extra.icon_adjust | default(value="svgs adjust") -%} + {%- if icon_adjust -%}<i type="reset" id="mode" class="js {{ icon_adjust }}"></i>{%- else -%}<i type="reset" id="mode" class="js mode">☀</i>{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- if config.languages | length > 0 %} + <div class="dropdown" type="Button"> {%- if lang != config.default_language %}{{ trans(key="flag" | safe, lang=lang) }}{% else %}{{ config.extra.flag.en }}{% endif %} + {%- if current_url %} + <div class="dropdown-content"> + {%- for lcode,flag in config.extra.flag -%} + {%- if lang != lcode -%} + {%- if lcode == config.default_language -%} + <a type="Button" href="{{ current_url | replace(from=current_path | truncate(length=4, end=""), to="/") | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> + {%- else -%} + <a type="Button" href="{{ current_url | replace(from=config.base_url, to=config.base_url ~ "/" ~ lcode) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> + {%- endif -%} + {%- endif -%} + {%- endfor -%} + </div> + {%- endif %} + </span> </div> {%- endif %} </div> - {%- endif %} - </div> - {%- if config.build_search_index %} - {%- set icon_search=config.extra.icon_search | default(value="svgs search") %} - <div> - <form autocomplete=off class="js" name="goSearch" id="searchbox"> - <div class="searchd"> - <input id="searchinput" type="text" placeholder="{%- if lang != config.default_language %}{{ trans(key="Search" | safe, lang=lang) }}{% else %}Search{% endif %}" title="Search"{% if config.extra.search_library %}{% if config.extra.search_library == "stork" %} data-stork="stork" {% endif %}{% endif %} /> - <button type="submit" title="Search" class="{%- if icon_search -%}{{ icon_search }}{%- else -%}si{%- endif -%}">{%- if not icon_search -%}⌕{%- endif -%}</button> + <div> + {%- if config.build_search_index %} + {%- set icon_search=config.extra.icon_search | default(value="svgs search") %} + <div> + <form autocomplete=off class="js" name="goSearch" id="searchbox"> + <div class="searchd"> + <input id="searchinput" type="text" placeholder="{%- if lang != config.default_language %}{{ trans(key="Search" | safe, lang=lang) }}{% else %}Search{% endif %}" title="Search"{% if config.extra.search_library %}{% if config.extra.search_library == "stork" %} data-stork="stork" {% endif %}{% endif %} /> + <button type="submit" title="Search" class="{%- if icon_search -%}{{ icon_search }}{%- else -%}si{%- endif -%}">{%- if not icon_search -%}⌕{%- endif -%}</button> + </div> + <div class="results"><div id="suggestions"{% if config.extra.search_library %}{% if config.extra.search_library == "stork" %} data-stork="stork-output" {% endif %}{% endif %}></div></div> + </form> </div> - <div class="results"><div id="suggestions"{% if config.extra.search_library %}{% if config.extra.search_library == "stork" %} data-stork="stork-output" {% endif %}{% endif %}></div></div> - </form> + {%- endif %} + </div> </div> - {%- endif %} </nav> {%- if config.extra.sitedesc %} {%- if config.description %} @@ -119,11 +116,12 @@ <hr /> {%- endif %} <div class="c"> - {{- social_macros::social_links(config=config) }} + {%- include "partials/social.html" %} {#- Copyright START #} {%- if config.extra.copyright | default(value=true) -%} {%- set current_year = now() | date(format="%Y") %} + {%- set current_year = '<span id="year">' ~ current_year ~ '</span>' %} {%- if config.extra.copyright_override -%} {%- if lang != config.default_language %} diff --git a/templates/categories/list.html b/templates/categories/list.html index bbfb6dc..641fcc4 100644 --- a/templates/categories/list.html +++ b/templates/categories/list.html @@ -14,7 +14,7 @@ {%- set description = config.description %} - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} + {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} {%- endblock seo %} {%- block content %} diff --git a/templates/categories/single.html b/templates/categories/single.html index 7e85232..be219aa 100644 --- a/templates/categories/single.html +++ b/templates/categories/single.html @@ -14,7 +14,7 @@ {%- set description = config.description %} - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} + {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} {%- endblock seo %} {%- block content %} diff --git a/templates/contact.fr.html b/templates/contact.fr.html deleted file mode 100644 index d23569d..0000000 --- a/templates/contact.fr.html +++ /dev/null @@ -1,49 +0,0 @@ -{# Cette page affiche la page de contact, par exemple: example.com/contact/ #} - -{% extends "base.html" %} - -{%- block seo %} - {{- super() }} - {%- set title_addition = "" %} - - {%- if page.title and config.title %} - {%- set title = page.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- elif page.title %} - {%- set title = page.title %} - {%- else %} - {%- set title = config.title %} - {%- endif %} - - {%- if page.description %} - {%- set description = page.description %} - {%- else %} - {%- set description = config.description %} - {%- endif %} - - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description) }} -{%- endblock seo %} - -{%- block content %} - <div> - <p>Vous voulez entrer en contact ? Remplissez le formulaire ci-dessous pour m'envoyer un message et je vous répondrai dans les plus brefs délais !</p> - <form name="contact" method="POST"> - <p> - <label for="name">Nom</label> - <input type="text" placeholder="Nom" id="name" required data-validation-required-message="S'il vous plaît entrez votre nom." /> - </p> - <p> - <label for="email">Adresse e-mail</label> - <input type="email" placeholder="nom@example.com" id="email" required data-validation-required-message="Veuillez saisir votre adresse e-mail." /> - </p> - <p> - <label for="message">Message</label> - <textarea rows="5" placeholder="Message" id="message" required data-validation-required-message="Veuillez entrer un message."></textarea> - </p> - <div id="success"></div> - <p> - <button type="submit" id="sendMessageButton">Envoyer</button> - </p> - </form> - </div> -{%- endblock content %} diff --git a/templates/contact.html b/templates/contact.html deleted file mode 100644 index 526bb61..0000000 --- a/templates/contact.html +++ /dev/null @@ -1,49 +0,0 @@ -{# This Page Shows the contact page eg: example.com/contact/ #} - -{% extends "base.html" %} - -{%- block seo %} - {{- super() }} - {%- set title_addition = "" %} - - {%- if page.title and config.title %} - {%- set title = page.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- elif page.title %} - {%- set title = page.title %} - {%- else %} - {%- set title = config.title %} - {%- endif %} - - {%- if page.description %} - {%- set description = page.description %} - {%- else %} - {%- set description = config.description %} - {%- endif %} - - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description) }} -{%- endblock seo %} - -{%- block content %} - <div> - <p>Want to get in touch? Fill out the form below to send me a message and I will get back to you as soon as possible!</p> - <form name="contact" method="POST"> - <p> - <label for="name">Name</label> - <input type="text" placeholder="Name" id="name" required data-validation-required-message="Please enter your name." /> - </p> - <p> - <label for="email">Email Address</label> - <input type="email" placeholder="name@example.com" id="email" required data-validation-required-message="Please enter your email address." /> - </p> - <p> - <label for="message">Message</label> - <textarea rows="5" placeholder="Message" id="message" required data-validation-required-message="Please enter a message."></textarea> - </p> - <div id="success"></div> - <p> - <button type="submit" id="sendMessageButton">Send</button> - </p> - </form> - </div> -{%- endblock content %} diff --git a/templates/index.html b/templates/index.html index a364912..705c630 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,6 +1,6 @@ {# -This Page Shows the Posts with a short summary on the index: example.com/ -This Template can also be used as the rendering template for Sections, eg: example.com/blog/ example.com/software/ +This Tempalte Shows a paginated page of the Posts of a section with a short summary. +This Template can also be used directly for the index eg: example.com/ or as the rendering template for Sections, eg: example.com/blog/ example.com/software/ #} {%- extends "base.html" %} @@ -26,7 +26,7 @@ This Template can also be used as the rendering template for Sections, eg: examp {%- set description = config.description %} - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} + {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} {%- endblock seo %} @@ -80,12 +80,12 @@ This Template can also be used as the rendering template for Sections, eg: examp {%- else %} {%- set section_item = get_section(path=sec ~ "_index." ~ lang ~ ".md") %} {%- endif %} - <div class="toc"> - <div class="toc-sticky"> - <h1><span class="s70">{%- if lang != config.default_language %}{{ trans(key="Recent_Posts" | safe, lang=lang) }}{% else %}Recent Posts{% endif %}</span></h1> + <div class="sblock"> + <div class="blockdiv sticky"> + <span class="b s150">{%- if lang != config.default_language %}{{ trans(key="Recent_Posts" | safe, lang=lang) }}{% else %}Recent Posts{% endif %}</span> {%- set recent_items=config.extra.recent_items | default(value=9) -%} {%- for page in section_item.pages | slice(end=recent_items) %} - {{- page_macros::page_listing(page=page, config=config) }} + {{- macros::page_listing(page=page, config=config) }} {%- endfor %} </div> </div> diff --git a/templates/macros/macros.html b/templates/macros/macros.html index 000130a..66673d1 100644 --- a/templates/macros/macros.html +++ b/templates/macros/macros.html @@ -1,9 +1,21 @@ +{%- macro page_listing(page, config) %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} + <div class="tpad"> + <a href="{{ page.permalink | safe}}{%- if uglyurls %}index.html{%- endif %}">{{ page.title }}</a> + </div> +{%- endmacro page_listing %} + + + {%- macro title_post(page, config) %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} <h1><a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ page.title }}</a></h1> {%- endmacro title_post %} + + {%- macro meta_post(page, config) %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} @@ -29,7 +41,7 @@ {#- divider #} {%- if config.extra.meta_post.author %} {%- if config.extra.meta_post.readtime or config.extra.meta_post.date or config.extra.meta_post.updated or config.extra.meta_post.categories_tags %} - {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %} + {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %} {%- endif %} {%- endif %} @@ -37,7 +49,7 @@ {%- if config.extra.meta_post.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_post.readstring | default(value="min") }} {#- divider #} {%- if config.extra.meta_post.date or config.extra.meta_post.updated or config.extra.meta_post.categories_tags %} - {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %} + {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{%- endif %} {#- Date #} {%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} @@ -51,7 +63,7 @@ {%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %} {#- divider #} {%- if config.extra.meta_post.updated or config.extra.meta_post.categories_tags %} - {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} + {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} {#- Updated #} {%- if config.extra.meta_post.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif -%} @@ -65,7 +77,7 @@ {%- else %} {{ page.updated | date(format="%B %d, %Y") }} {%- endif %} {#- divider #} {%- if config.extra.meta_post.categories_tags %} - {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} + {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} {#- Categories #} {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} @@ -74,6 +86,8 @@ {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> {%- endmacro meta_post %} + + {%- macro title_index(page, config) %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} @@ -81,6 +95,7 @@ {%- endmacro title_index %} + {%- macro meta_index(page, config) %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} @@ -106,7 +121,7 @@ {#- divider #} {%- if config.extra.meta_index.author %} {%- if config.extra.meta_index.readtime or config.extra.meta_index.date or config.extra.meta_index.updated or config.extra.meta_index.categories_tags %} - {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %} + {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %} {%- endif %} {%- endif %} @@ -114,7 +129,7 @@ {%- if config.extra.meta_index.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_index.readstring | default(value="min") }} {#- divider #} {%- if config.extra.meta_index.date or config.extra.meta_index.updated or config.extra.meta_index.categories_tags %} - {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %} + {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{%- endif %} {#- Date #} {%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} @@ -128,7 +143,7 @@ {%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %} {#- divider #} {%- if config.extra.meta_index.updated or config.extra.meta_index.categories_tags %} - {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} + {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} {#- Updated #} {%- if config.extra.meta_index.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif -%} @@ -143,7 +158,7 @@ {#- divider #} {%- if config.extra.meta_index.categories_tags %} - {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} + {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} {#- Categories #} {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} @@ -154,7 +169,6 @@ - {%- macro footer(page, config) %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} @@ -178,6 +192,7 @@ {%- endmacro footer %} + {%- macro pagination(paginator, config)%} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} diff --git a/templates/macros/page.html b/templates/macros/page.html deleted file mode 100644 index 23b9e09..0000000 --- a/templates/macros/page.html +++ /dev/null @@ -1,7 +0,0 @@ -{%- macro page_listing(page, config) %} -{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} - <div class="toc-item"> - <a href="{{ page.permalink | safe}}{%- if uglyurls %}index.html{%- endif %}">{{ page.title }}</a> - </div> -{%- endmacro page_listing %} diff --git a/templates/macros/seo.html b/templates/macros/seo.html new file mode 100644 index 0000000..8d2ada1 --- /dev/null +++ b/templates/macros/seo.html @@ -0,0 +1,140 @@ +{#- type: website or article, generally setting article for blog articles -#} +{#- page_images: using for the blog single template page -#} +{#- page_section: the blog single template page have to pass the parameter -#} +{#- is_404: using for the 404.html template -#} + +{%- macro seo( config, title="", title_addition="", description="", type="website", is_home=false, is_404=false, is_page=false, page_images="", page_section="", created_time="2023-05-15T07:07:00-07:00", updated_time="2023-05-15T07:07:00-07:00" ) %} + +{%- if is_404 -%} + <meta name="robots" content="noindex, follow" /> +{%- else -%} + <meta name="robots" content="index, follow" /> + <meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" /> + <meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" /> +{%- endif -%} + +{%- if current_url %} + {%- set page_url = current_url %} +{%- else %} + {%- set page_url = get_url(path="404.html", trailing_slash=true) %} +{%- endif %} + <title>{{ title ~ title_addition }}</title> + +{%- if config.extra.author %} + <meta name="author" content="{{ config.extra.author }}" /> +{%- endif %} +{%- if config.extra.facebook_publisher %} + <meta property="article:publisher" content="https://www.facebook.com/{{ config.extra.facebook_publisher }}" /> +{%- endif %} + <meta name="copyright" content="{{ config.title }}" /> +{%- if config.extra.facebook_author %} + <meta property="article:author" content="https://www.facebook.com/{{ config.extra.facebook_author }}" /> +{%- endif %} +{%- if page.description %} + <meta name="description" content="{{ page.description }}" /> +{%- else %} + <meta name="description" content="{{ config.description }}" /> +{%- endif %} + <link rel="canonical" href="{{ page_url | safe }}" /> +{%- if page.extra.keywords and config.extra.keywords %} + <meta name="keywords" content="{{ page.extra.keywords }}, {{ config.extra.keywords }}" /> +{%- elif page.extra.keywords %} + <meta name="keywords" content="{{ page.extra.keywords }}" /> +{%- elif config.extra.keywords %} + <meta name="keywords" content="{{ config.extra.keywords }}" /> +{%- endif %} + +{#- Extra SEO START #} +{%- if config.extra.seo | default(value=true) %} +{%- if not is_404 %} + +{%- if config.extra.google %} + <meta name="google-site-verification" content="{{ config.extra.google | safe }}" /> +{%- endif %} + +{%- if config.extra.bing %} + <meta name="msvalidate.01" content="{{ config.extra.bing | safe}}" /> +{%- endif %} + <meta property="og:url" content="{{ page_url | safe }}" /> + <meta name="twitter:url" content="{{ page_url | safe }}" /> + +{%- if page.description %} + <meta property="og:description" content="{{ page.description }}" /> + <meta name="twitter:description" content="{{ page.description }}" /> +{%- else %} + <meta property="og:description" content="{{ config.description }}" /> + <meta name="twitter:description" content="{{ config.description}}" /> +{%- endif %} + +{%- if page.title %} + <meta property="og:title" content="{{ page.title }} | {{ config.title }}" /> + <meta name="twitter:title" content="{{ page.title }} | {{ config.title }}" /> +{%- else %} + <meta property="og:title" content="{{ config.title }}" /> + <meta name="twitter:title" content="{{ config.title }}" /> +{%- endif %} + + +{#- SEO MEDIA START #} +{%- if page.extra.thumbnail %} + <meta name="twitter:card" content="summary_large_image" /> + <meta name="twitter:image" content="{{ get_url(path=page.path ~ page.extra.thumbnail, trailing_slash=false) }}" /> + <meta property="og:image" content="{{ get_url(path=page.path ~ page.extra.thumbnail, trailing_slash=false) }}" /> + +{%- elif page.extra.static_thumbnail %} + <meta name="twitter:card" content="summary_large_image" /> + {%- if page.extra.static_thumbnail is matching("^http[s]?://") %} + <meta name="twitter:image" content="{{ page.extra.static_thumbnail }}" /> + <meta property="og:image" content="{{ page.extra.static_thumbnail }}" /> + {%- else %} + <meta name="twitter:image" content="{{ get_url(path=page.extra.static_thumbnail, trailing_slash=false) }}" /> + <meta property="og:image" content="{{ get_url(path=page.extra.static_thumbnail, trailing_slash=false) }}" /> + {%- endif %} + +{%- elif config.extra.banner %} + <meta name="twitter:card" content="summary_large_image" /> + <meta name="twitter:image" content="{{ get_url(path=config.extra.banner, trailing_slash=false) }}" /> + <meta property="og:image" content="{{ get_url(path=config.extra.banner, trailing_slash=false) }}" /> + +{%- else %} + <meta name="twitter:card" content="summary" /> + +{%- endif %} + +{%- if config.extra.open.audio %} + <meta property="og:audio" content="{{ config.extra.open.audio }}" /> +{%- endif %} + +{%- if config.extra.open.locale %} + <meta property="og:locale" content="{{ config.extra.open.locale }}" /> +{%- endif %} + +{%- if config.extra.open.videos %} + {%- for video in config.extra.open.videos %} + <meta property="og:video" content="{{ get_url(path=video) }}" /> + {%- endfor %} +{%- endif %} + +{#- SEO MEDIA END #} + <meta property="og:site_name" content="{{ config.title }}" /> + <meta property="og:locale" content="en_US" /> + <meta property="og:type" content="website" /> +{%- if page.updated %} + <meta property="og:updated_time" content="{{ page.updated | date(format='%F') }}" /> +{%- elif page.date %} + <meta property="og:updated_time" content="{{ page.date | date(format='%F') }}" /> +{%- else %} + <meta property="og:updated_time" content="{{ updated_time }}" /> +{%- endif %} + +{%- if config.extra.twitter_meta %} + <meta name="twitter:site" content="@{{ config.extra.twitter_meta }}" /> + <meta name="twitter:creator" content="@{{ config.extra.twitter_meta }}" /> +{%- endif %} + + + +{%- endif %} +{%- endif %} +{#- Extra SEO END #} +{%- endmacro %} diff --git a/templates/page.html b/templates/page.html index 253b0d9..198e190 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,4 +1,4 @@ -{# This Page Shows the Individual Blog Posts#} +{# This Template Shows the Individual Blog Posts#} {% extends "base.html" %} @@ -27,7 +27,7 @@ {%- set page_section = "" %} {%- endif %} - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description, type="article", is_page=true, created_time=created_time, updated_time=updated_time, page_section=page_section) }} + {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, type="article", is_page=true, created_time=created_time, updated_time=updated_time, page_section=page_section) }} {%- endblock seo %} {%- block comments_init %} @@ -45,33 +45,35 @@ {{- macros::meta_post(page=page, config=config) }} {%- endif %}{%- endif %} - + {# In Page Series Navigation #} + {%- if config.extra.series | default(value=true) %} {%- if page.extra.section %} - + {%- set tag = get_taxonomy_term(kind="tags", term=page.extra.section, lang=lang) %} {%- set page_num = tag.page_count | as_str %} {%- if lang != config.default_language %} {%- set parts_string = trans(key="Series_parts", lang=lang) | replace(from="$NUMBER_OF_PARTS", to=page_num) %} {% else %} - {%- set parts_string = page_num ~ " part Series" %} + {%- set parts_string = config.extra.Series_parts | default(value="Series") | replace(from="$NUMBER_OF_PARTS", to=page_num) %} {% endif -%} - - - <div class="series-mobile series"> - <a class="si" href="{{ tag.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag.name }} ({{ parts_string }})</a> - <ol> - {%- for inner in tag.pages | sort(attribute="year") %} - {%- if inner.content == page.content %} - <li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}"><b>{{ inner.title }}</b></a></li> - {% else %} - <li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a></li> - {%- endif %} - {%- endfor %} - </ol> + <div class="block"> + <div class="blockdiv"> + <a class="b s150" href="{{ tag.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag.name }} ({{ parts_string }})</a> + <ol> + {%- for inner in tag.pages | sort(attribute="year") %} + {%- if inner.content == page.content %} + <li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}"><b>{{ inner.title }}</b></a></li> + {% else %} + <li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a></li> + {%- endif %} + {%- endfor %} + </ol> + </div> </div> {%- endif %} + {%- endif %} {{ page.content | safe }} @@ -92,15 +94,16 @@ {%- endblock comments_body %} </article> {%- block toc %} - {%- if page.extra.toc and config.extra.recent %} + {%- if config.extra.toc | default(value=true) %} + {%- if page.extra.toc %} {%- set toc = page.toc %} {%- endif %} {%- if toc %} - - <div class="toc"> + + <div class="sblock"> {%- if page.extra.section %} - <div class="series-toc series"> - <a class="si" href="{{ tag.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ parts_string }}</a> + <div class="blockdiv"> + <a class="b s150" href="{{ tag.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ parts_string }}</a> <ol> {%- for inner in tag.pages | sort(attribute="year") %} {%- if inner.content == page.content %} @@ -113,16 +116,16 @@ </div> {%- endif %} - <div class="toc-sticky"> - <a class="si" href="#">{%- if lang != config.default_language %}{{ trans(key="Index" | safe, lang=lang) }}{% else %}Index{% endif %}</a> + <div class="blockdiv sticky"> + <a class="b s150" href="#">{%- if lang != config.default_language %}{{ trans(key="Index" | safe, lang=lang) }}{% else %}Index{% endif %}</a> {%- for h in toc %} - <div class="toc-item"> - <a class="subtext" href="#{{h.id | safe}}">{{ h.title }}</a> + <div> + <a href="#{{h.id | safe}}">{{ h.title }}</a> </div> {%- if h.children %} {%- for h2 in h.children %} - <div class="toc-item-child"> - <a class="subtext" href="#{{h2.id | safe}}"><small>- {{ h2.title }}</small></a> + <div class="hpad"> + <a href="#{{h2.id | safe}}"><small>- {{ h2.title }}</small></a> </div> {%- endfor %} {%- endif %} @@ -130,6 +133,7 @@ </div> </div> {%- endif %} + {%- endif %} {%- endblock toc %} {%- endblock content %} diff --git a/templates/pages.html b/templates/pages.html index 4ef44f5..72f4071 100644 --- a/templates/pages.html +++ b/templates/pages.html @@ -1,4 +1,8 @@ -{# This Page Shows the 'Pages' (abridge/content/pages) eg: example.com/about/ example.com/privacy/ #} +{# +This Template is for the 'Pages' (abridge/content/pages) eg: example.com/about/ example.com/privacy/ +This Template can also be used as a home page for the index, eg: example.com/ +Some people prefer a landing page for the index, and then use a separate paginated page for their blog. +#} {% extends "base.html" %} @@ -9,24 +13,35 @@ {%- if page.title and config.title %} {%- set title = page.title %} {%- set title_addition = title_separator ~ config.title %} + {%- elif section.title and config.title %} + {%- set title = section.title %} + {%- set title_addition = title_separator ~ config.title %} {%- elif page.title %} {%- set title = page.title %} + {%- elif section.title %} + {%- set title = section.title %} {%- else %} {%- set title = config.title %} {%- endif %} {%- if page.description %} {%- set description = page.description %} + {%- elif section.description %} + {%- set description = section.description %} {%- else %} {%- set description = config.description %} {%- endif %} - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description) }} + {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description) }} {%- endblock seo %} {%- block content %} <div> +{%- if page.content %} {{ page.content | safe }} +{%- elif section.content %} +{{ section.content | safe }} +{%- endif %} </div> {%- endblock content %} diff --git a/templates/partials/head.html b/templates/partials/head.html new file mode 100644 index 0000000..4e6b713 --- /dev/null +++ b/templates/partials/head.html @@ -0,0 +1,131 @@ + +{#- Theme Switcher Button to toggle between dark/light #} + {%- set integrity = config.extra.integrity | default(value=true) -%} + {%- if config.extra.offline %}{% set integrity = false %}{% endif %} + + {%- if config.extra.js_switcher | default(value=true) %} + {%- set js_theme="js/theme.min.js" %} + {%- if config.extra.js_switcher_default %} + {%- if config.extra.js_switcher_default == "light" %}{% set js_theme="js/theme_light.min.js" %}{% endif %} + {%- endif %} + <script src="{{ get_url(path=js_theme , trailing_slash=false) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=js_theme, sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- endif %} + + + + + +{#- Style Sheets #} + {%- set stylesheets=config.extra.stylesheets | default(value=[ "abridge.css" ]) -%} + {%- if stylesheets %}{%- for i in stylesheets %} + <link rel="stylesheet" href="{{ get_url(path=i , trailing_slash=false, cachebust=true) | safe }}" /> + {%- endfor %}{%- endif %} + + + + + +{#- meta tags #} + <meta charset="utf-8" /> + <meta http-equiv="x-ua-compatible" content="ie=edge" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="base" content="{{ config.base_url | safe }}" /> + <meta name="HandheldFriendly" content="True" /> + <meta name="mobile-web-app-capable" content="yes" /> + <meta name="apple-mobile-web-app-capable" content="yes" /> + <meta name="apple-mobile-web-app-status-bar-style" content="default" /> + + + + + +{#- Security: CSP, referrer #} + {%- if config.extra.security_header_referrer %} + <meta name="referrer" content="{{ config.extra.security_header_referrer | safe }}" /> + {%- endif %} + {%- if config.extra.security_header_csp %} + <meta http-equiv="Content-Security-Policy" content="{{ config.extra.security_header_csp | safe }}" /> + {%- endif %} + + + + + +{#- Favicons #} + {%- if config.extra.favicon_theme_color %} + <meta name="theme-color" content="{{ config.extra.favicon_theme_color }}" /> + {%- endif %} + + {%- if config.extra.favicon_ms_color %} + <meta name="msapplication-TileColor" content="{{ config.extra.favicon_ms_color }}" /> + {%- endif %} + + {%- if config.extra.webmanifest %} + <link rel="manifest" href="{{ get_url(path=config.extra.webmanifest, trailing_slash=false) | safe }}" /> + {%- endif %} + + {%- if config.extra.favicon_mask and config.extra.favicon_mask_color %} + <link rel="mask-icon" href="{{ get_url(path=config.extra.favicon_mask, trailing_slash=false) | safe }}" color="{{ config.extra.favicon_mask_color }}" /> + {%- endif %} + + {%- if config.extra.favicon_svg %} + <link rel="icon" type="image/svg+xml" href="{{ get_url(path=config.extra.favicon_svg, trailing_slash=false) | safe }}" /> + {%- endif %} + + {%- if config.extra.favicon180 %} + <link rel="apple-touch-icon" sizes="180x180" href="{{ get_url(path=config.extra.favicon180, trailing_slash=false) | safe }}" /> + {%- endif %} + + {%- if config.extra.favicon32 %} + <link rel="icon" type="image/png" sizes="32x32" href="{{ get_url(path=config.extra.favicon32, trailing_slash=false) | safe }}" /> + {%- endif %} + + {%- if config.extra.favicon16 %} + <link rel="icon" type="image/png" sizes="16x16" href="{{ get_url(path=config.extra.favicon16, trailing_slash=false) | safe }}" /> + {%- endif %} + + + + + +{#- Style Sheets Preload #} + {%- set integrity = config.extra.integrity | default(value=true) -%} + {%- if config.extra.offline %}{% set integrity = false %}{% endif %} + +{%- if config.extra.fonts %}{%- for i in config.extra.fonts %} + {%- if i.url is matching("^http[s]?://") %} + <link rel="preload" as="style" class="preStyle" href="{{ i.url | safe }}" crossorigin="anonymous" /> + {%- else %} + <link rel="preload" as="font" href="{{ get_url(path=i.url, trailing_slash=false) | safe }}" type="font/woff2" /> + {%- endif %} +{%- endfor %}{%- endif %} + +{%- if config.extra.fontawesome %} + <link rel="preload" as="style" class="preStyle" href="{{ config.extra.fontawesome | safe }}" crossorigin="anonymous" /> +{%- endif %} + +{%- if config.extra.math or page.extra.math %} + + {%- set katex_css=config.extra.katex_css | default(value="katex.min.css") -%} + {%- if katex_css %}{%- if katex_css is matching("^http[s]?://") %} + <link rel="preload" as="style" class="preStyle" href="{{ katex_css | safe }}"{%- if integrity and config.extra.katex_css_integrity %} integrity="{{ config.extra.katex_css_integrity | safe }}"{%- endif %} crossorigin="anonymous" /> + {%- else %} + <link rel="preload" as="style" class="preStyle" href="{{ get_url(path=katex_css, trailing_slash=false) }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=katex_css, sha_type=384, base64=true) | safe }}"{%- endif %} /> + {%- endif %}{%- endif %} + +{%- endif %} + + + + + +{#- Rss / Atom Feed #} + {%- if config.generate_feed %} + <link rel="alternate" type="{% if config.feed_filename is containing('atom') %}application/atom+xml{% else %}application/rss+xml{% endif %}" title="{{ config.title }} Atom/RSS Feed" href="{{ get_url(path=config.feed_filename, trailing_slash=false, lang=lang) | safe }}" /> + {%- endif %} + + + + + +{#- End of head partial -#} diff --git a/templates/macros/head.html b/templates/partials/head_js.html index 3ed3af0..9a5604a 100644 --- a/templates/macros/head.html +++ b/templates/partials/head_js.html @@ -1,66 +1,4 @@ -{#- Theme Switcher Button to toggle between dark/light #} -{%- macro theme(config) %} - {%- set integrity = config.extra.integrity | default(value=true) -%} - {%- if config.extra.offline %}{% set integrity = false %}{% endif %} - - {%- if config.extra.js_switcher | default(value=true) %} - {%- set js_theme="js/theme.min.js" %} - {%- if config.extra.js_switcher_default %} - {%- if config.extra.js_switcher_default == "light" %}{% set js_theme="js/theme_light.min.js" %}{% endif %} - {%- endif %} - <script src="{{ get_url(path=js_theme , trailing_slash=false) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=js_theme, sha_type=384, base64=true) | safe }}"{%- endif %}></script> - {%- endif %} -{%- endmacro %} - -{%- macro stylesheets(config) %} - {%- set stylesheets=config.extra.stylesheets | default(value=[ "abridge.css" ]) -%} - {%- if stylesheets %}{%- for i in stylesheets %} - <link rel="stylesheet" href="{{ get_url(path=i , trailing_slash=false, cachebust=true) | safe }}" /> - {%- endfor %}{%- endif %} -{%- endmacro %} - - - -{%- macro stylesheets_preload(config) %} - {%- set integrity = config.extra.integrity | default(value=true) -%} - {%- if config.extra.offline %}{% set integrity = false %}{% endif %} - -{%- if config.extra.fonts %}{%- for i in config.extra.fonts %} - {%- if i.url is matching("^http[s]?://") %} - <link rel="preload" as="style" class="preStyle" href="{{ i.url | safe }}" crossorigin="anonymous" /> - {%- else %} - <link rel="preload" as="font" href="{{ get_url(path=i.url, trailing_slash=false) | safe }}" type="font/woff2" /> - {%- endif %} -{%- endfor %}{%- endif %} - -{%- if config.extra.fontawesome %} - <link rel="preload" as="style" class="preStyle" href="{{ config.extra.fontawesome | safe }}" crossorigin="anonymous" /> -{%- endif %} - -{%- if config.extra.math or page.extra.math %} - - {%- set katex_css=config.extra.katex_css | default(value="katex.min.css") -%} - {%- if katex_css %}{%- if katex_css is matching("^http[s]?://") %} - <link rel="preload" as="style" class="preStyle" href="{{ katex_css | safe }}"{%- if integrity and config.extra.katex_css_integrity %} integrity="{{ config.extra.katex_css_integrity | safe }}"{%- endif %} crossorigin="anonymous" /> - {%- else %} - <link rel="preload" as="style" class="preStyle" href="{{ get_url(path=katex_css, trailing_slash=false) }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=katex_css, sha_type=384, base64=true) | safe }}"{%- endif %} /> - {%- endif %}{%- endif %} - -{%- endif %} - -{%- endmacro %} - - - -{%- macro feed(config) %} - {%- if config.generate_feed %} - <link rel="alternate" type="{% if config.feed_filename is containing('atom') %}application/atom+xml{% else %}application/rss+xml{% endif %}" title="{{ config.title }} Atom/RSS Feed" href="{{ get_url(path=config.feed_filename, trailing_slash=false, lang=lang) | safe }}" /> - {%- endif %} -{%- endmacro %} - - - -{%- macro js(config) %} +{#- JAVASCRIPT #} {%- set integrity = config.extra.integrity | default(value=true) -%} {%- if config.extra.offline %}{% set integrity = false %}{% endif %} {%- set search_library=config.extra.search_library | default(value="elasticlunr") -%} @@ -173,6 +111,10 @@ {%- endif %} + + + +{#- Katex #} {#- https://katex.org/docs/autorender.html #} {#- https://github.com/KaTeX/KaTeX/ #} {#- https://github.com/KaTeX/KaTeX/tree/main/contrib/mathtex-script-type/ #} @@ -214,193 +156,10 @@ {%- endif %} {%- endif %} + <noscript><link rel="stylesheet" href="{{ get_url(path='nojs.css', trailing_slash=false) | safe }}" /></noscript> -{%- endmacro %} - - - -{%- macro favicons(config) %} - {%- if config.extra.favicon_theme_color %} - <meta name="theme-color" content="{{ config.extra.favicon_theme_color }}" /> - {%- endif %} - - {%- if config.extra.favicon_ms_color %} - <meta name="msapplication-TileColor" content="{{ config.extra.favicon_ms_color }}" /> - {%- endif %} - - {%- if config.extra.webmanifest %} - <link rel="manifest" href="{{ get_url(path=config.extra.webmanifest, trailing_slash=false) | safe }}" /> - {%- endif %} - {%- if config.extra.favicon_mask and config.extra.favicon_mask_color %} - <link rel="mask-icon" href="{{ get_url(path=config.extra.favicon_mask, trailing_slash=false) | safe }}" color="{{ config.extra.favicon_mask_color }}" /> - {%- endif %} - - {%- if config.extra.favicon_svg %} - <link rel="icon" type="image/svg+xml" href="{{ get_url(path=config.extra.favicon_svg, trailing_slash=false) | safe }}" /> - {%- endif %} - - {%- if config.extra.favicon180 %} - <link rel="apple-touch-icon" sizes="180x180" href="{{ get_url(path=config.extra.favicon180, trailing_slash=false) | safe }}" /> - {%- endif %} - - {%- if config.extra.favicon32 %} - <link rel="icon" type="image/png" sizes="32x32" href="{{ get_url(path=config.extra.favicon32, trailing_slash=false) | safe }}" /> - {%- endif %} - - {%- if config.extra.favicon16 %} - <link rel="icon" type="image/png" sizes="16x16" href="{{ get_url(path=config.extra.favicon16, trailing_slash=false) | safe }}" /> - {%- endif %} -{%- endmacro %} -{%- macro security(config) %} - {%- if config.extra.security_header_referrer %} - <meta name="referrer" content="{{ config.extra.security_header_referrer | safe }}" /> - {%- endif %} - {%- if config.extra.security_header_csp %} - <meta http-equiv="Content-Security-Policy" content="{{ config.extra.security_header_csp | safe }}" /> - {%- endif %} -{%- endmacro %} - - - -{#- type: website or article, generally setting article for blog articles -#} -{#- page_images: using for the blog single template page -#} -{#- page_section: the blog single template page have to pass the parameter -#} -{#- is_404: using for the 404.html template -#} -{%- macro seo( config, title="", title_addition="", description="", type="website", is_home=false, is_404=false, is_page=false, page_images="", page_section="", created_time="2023-05-15T07:07:00-07:00", updated_time="2023-05-15T07:07:00-07:00" ) %} -{%- if is_404 -%} - <meta name="robots" content="noindex, follow" /> -{%- else -%} - <meta name="robots" content="index, follow" /> - <meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" /> - <meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" /> -{%- endif -%} - -{%- if current_url %} - {%- set page_url = current_url %} -{%- else %} - {%- set page_url = get_url(path="404.html", trailing_slash=true) %} -{%- endif %} - <title>{{ title ~ title_addition }}</title> - -{%- if config.extra.author %} - <meta name="author" content="{{ config.extra.author }}" /> -{%- endif %} -{%- if config.extra.facebook_publisher %} - <meta property="article:publisher" content="https://www.facebook.com/{{ config.extra.facebook_publisher }}" /> -{%- endif %} - <meta name="copyright" content="{{ config.title }}" /> -{%- if config.extra.facebook_author %} - <meta property="article:author" content="https://www.facebook.com/{{ config.extra.facebook_author }}" /> -{%- endif %} -{%- if page.description %} - <meta name="description" content="{{ page.description }}" /> -{%- else %} - <meta name="description" content="{{ config.description }}" /> -{%- endif %} - <link rel="canonical" href="{{ page_url | safe }}" /> -{%- if page.extra.keywords and config.extra.keywords %} - <meta name="keywords" content="{{ page.extra.keywords }}, {{ config.extra.keywords }}" /> -{%- elif page.extra.keywords %} - <meta name="keywords" content="{{ page.extra.keywords }}" /> -{%- elif config.extra.keywords %} - <meta name="keywords" content="{{ config.extra.keywords }}" /> -{%- endif %} - -{#- Extra SEO START #} -{%- if config.extra.seo | default(value=true) %} -{%- if not is_404 %} - -{%- if config.extra.google %} - <meta name="google-site-verification" content="{{ config.extra.google | safe }}" /> -{%- endif %} - -{%- if config.extra.bing %} - <meta name="msvalidate.01" content="{{ config.extra.bing | safe}}" /> -{%- endif %} - <meta property="og:url" content="{{ page_url | safe }}" /> - <meta name="twitter:url" content="{{ page_url | safe }}" /> - -{%- if page.description %} - <meta property="og:description" content="{{ page.description }}" /> - <meta name="twitter:description" content="{{ page.description }}" /> -{%- else %} - <meta property="og:description" content="{{ config.description }}" /> - <meta name="twitter:description" content="{{ config.description}}" /> -{%- endif %} - -{%- if page.title %} - <meta property="og:title" content="{{ page.title }} | {{ config.title }}" /> - <meta name="twitter:title" content="{{ page.title }} | {{ config.title }}" /> -{%- else %} - <meta property="og:title" content="{{ config.title }}" /> - <meta name="twitter:title" content="{{ config.title }}" /> -{%- endif %} - - -{#- SEO MEDIA START #} -{%- if page.extra.thumbnail %} - <meta name="twitter:card" content="summary_large_image" /> - <meta name="twitter:image" content="{{ get_url(path=page.path ~ page.extra.thumbnail, trailing_slash=false) }}" /> - <meta property="og:image" content="{{ get_url(path=page.path ~ page.extra.thumbnail, trailing_slash=false) }}" /> - -{%- elif page.extra.static_thumbnail %} - <meta name="twitter:card" content="summary_large_image" /> - {%- if page.extra.static_thumbnail is matching("^http[s]?://") %} - <meta name="twitter:image" content="{{ page.extra.static_thumbnail }}" /> - <meta property="og:image" content="{{ page.extra.static_thumbnail }}" /> - {%- else %} - <meta name="twitter:image" content="{{ get_url(path=page.extra.static_thumbnail, trailing_slash=false) }}" /> - <meta property="og:image" content="{{ get_url(path=page.extra.static_thumbnail, trailing_slash=false) }}" /> - {%- endif %} - -{%- elif config.extra.banner %} - <meta name="twitter:card" content="summary_large_image" /> - <meta name="twitter:image" content="{{ get_url(path=config.extra.banner, trailing_slash=false) }}" /> - <meta property="og:image" content="{{ get_url(path=config.extra.banner, trailing_slash=false) }}" /> - -{%- else %} - <meta name="twitter:card" content="summary" /> - -{%- endif %} - -{%- if config.extra.open.audio %} - <meta property="og:audio" content="{{ config.extra.open.audio }}" /> -{%- endif %} - -{%- if config.extra.open.locale %} - <meta property="og:locale" content="{{ config.extra.open.locale }}" /> -{%- endif %} - -{%- if config.extra.open.videos %} - {%- for video in config.extra.open.videos %} - <meta property="og:video" content="{{ get_url(path=video) }}" /> - {%- endfor %} -{%- endif %} - -{#- SEO MEDIA END #} - <meta property="og:site_name" content="{{ config.title }}" /> - <meta property="og:locale" content="en_US" /> - <meta property="og:type" content="website" /> -{%- if page.updated %} - <meta property="og:updated_time" content="{{ page.updated | date(format='%F') }}" /> -{%- elif page.date %} - <meta property="og:updated_time" content="{{ page.date | date(format='%F') }}" /> -{%- else %} - <meta property="og:updated_time" content="{{ updated_time }}" /> -{%- endif %} - -{%- if config.extra.twitter_meta %} - <meta name="twitter:site" content="@{{ config.extra.twitter_meta }}" /> - <meta name="twitter:creator" content="@{{ config.extra.twitter_meta }}" /> -{%- endif %} - - - -{%- endif %} -{%- endif %} -{#- Extra SEO END #} -{%- endmacro %} +{#- End of head_js partial -#} diff --git a/templates/macros/social.html b/templates/partials/social.html index 8661976..aaca83d 100644 --- a/templates/macros/social.html +++ b/templates/partials/social.html @@ -1,4 +1,4 @@ -{%- macro social_links(config) %} +{#- Social Footer Icons #} <nav><div> {%- if config.generate_feed and config.extra.feed -%} <a type="{% if config.feed_filename is containing('atom') %}application/atom+xml{% else %}application/rss+xml{% endif %}" href="{{ get_url(path=config.feed_filename, trailing_slash=false, lang=lang) | safe }}" target="_blank" title="{{ config.title }} Atom/RSS Feed"><i type="Button" class="svg rss" title="{{ config.title }} Atom/RSS Feed"></i></a>{% endif -%} @@ -55,4 +55,9 @@ {%- if config.extra.github_sponsor -%} <a href="https://github.com/sponsors/{{ config.extra.github_sponsor }}/" target="_blank" title="GitHub Sponsor"><i type="Button" class="svg github-sponsor" title="GitHub Sponsor"></i></a>{% endif -%} </div></nav> -{%- endmacro %} + + + + + +{#- End of social partial -#} diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html index f5754ce..ac3ba6b 100644 --- a/templates/shortcodes/img.html +++ b/templates/shortcodes/img.html @@ -1,15 +1,16 @@ {%- set img = src | split(pat="/") | last %} {%- set dirtest = src | trim_start_matches(pat="./") %} {%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %} +{%- if page.path %}{%- set pagepath = page.path %}{%- elif section.path %}{%- set pagepath = section.path %}{%- endif %} {%- if src is starting_with("./") and reldir %} {# Relative Path #} {%- set path = src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %} {%- set path = path ~ "/" %} {%- if not w or not h %} {%- if lang != config.default_language %} - {%- set metapath = page.path ~ path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %} + {%- set metapath = pagepath ~ path ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} {%- else %} - {%- set metapath = page.path ~ path ~ img %} + {%- set metapath = pagepath ~ path ~ img %} {%- endif %} {%- set meta = get_image_metadata(path=metapath) %} {%- set w = meta.width %} @@ -30,9 +31,9 @@ {%- set path = "" %} {%- if not w or not h %} {%- if lang != config.default_language %} - {%- set metapath = page.path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %} + {%- set metapath = pagepath ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} {%- else %} - {%- set metapath = page.path ~ img %} + {%- set metapath = pagepath ~ img %} {%- endif %} {%- set meta = get_image_metadata(path=metapath) %} {%- set w = meta.width %} diff --git a/templates/shortcodes/imgswap.html b/templates/shortcodes/imgswap.html index efcf6e7..80a3b74 100644 --- a/templates/shortcodes/imgswap.html +++ b/templates/shortcodes/imgswap.html @@ -2,15 +2,16 @@ {%- set img = main_src | split(pat="/") | last %} {%- set dirtest = main_src | trim_start_matches(pat="./") %} {%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %} + {%- if page.path %}{%- set pagepath = page.path %}{%- elif section.path %}{%- set pagepath = section.path %}{%- endif %} {%- if main_src is starting_with("./") and reldir %} {# Relative Path #} {%- set path = main_src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %} {%- set path = path ~ "/" %} {%- if not w or not h %} {%- if lang != config.default_language %} - {%- set metapath = page.path ~ path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %} + {%- set metapath = pagepath ~ path ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} {%- else %} - {%- set metapath = page.path ~ path ~ img %} + {%- set metapath = pagepath ~ path ~ img %} {%- endif %} {%- set meta = get_image_metadata(path=metapath) %} {%- set w = meta.width %} @@ -31,9 +32,9 @@ {%- set path = "" %} {%- if not w or not h %} {%- if lang != config.default_language %} - {%- set metapath = page.path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %} + {%- set metapath = pagepath ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} {%- else %} - {%- set metapath = page.path ~ img %} + {%- set metapath = pagepath ~ img %} {%- endif %} {%- set meta = get_image_metadata(path=metapath) %} {%- set w = meta.width %} @@ -55,9 +56,9 @@ {%- set path = path ~ "/" %} {%- if not w or not h %} {%- if lang != config.default_language %} - {%- set metapath = page.path ~ path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %} + {%- set metapath = pagepath ~ path ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} {%- else %} - {%- set metapath = page.path ~ path ~ img %} + {%- set metapath = pagepath ~ path ~ img %} {%- endif %} {%- set meta = get_image_metadata(path=metapath) %} {%- set w = meta.width %} @@ -78,9 +79,9 @@ {%- set path = "" %} {%- if not w or not h %} {%- if lang != config.default_language %} - {%- set metapath = page.path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %} + {%- set metapath = pagepath ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} {%- else %} - {%- set metapath = page.path ~ img %} + {%- set metapath = pagepath ~ img %} {%- endif %} {%- set meta = get_image_metadata(path=metapath) %} {%- set w = meta.width %} diff --git a/templates/shortcodes/showdata.html b/templates/shortcodes/showdata.html index 9c14444..7f3d3bc 100644 --- a/templates/shortcodes/showdata.html +++ b/templates/shortcodes/showdata.html @@ -1,3 +1,5 @@ +{# showdata(src="../theme.toml" type="toml" key="min_version") #} + {%- if src and key and type %} {%- if src is matching("^http[s]?://") %} {% set data = load_data(url=src, format=type) %} @@ -5,4 +7,12 @@ {% set data = load_data(path=src, format=type) %} {%- endif %} {{ data[key] }} +{%- else %} + {# Load other file types as plain text #} + {%- if src is matching("^http[s]?://") %} + {% set data = load_data(url=src) %} + {%- else %} + {% set data = load_data(path=src) %} + {%- endif %} + {{ data }} {%- endif %} diff --git a/templates/tags/list.html b/templates/tags/list.html index 2124b02..4f53a58 100644 --- a/templates/tags/list.html +++ b/templates/tags/list.html @@ -14,7 +14,7 @@ {%- set description = config.description %} - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} + {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} {%- endblock seo %} {%- block content %} diff --git a/templates/tags/single.html b/templates/tags/single.html index d21d9b0..a57b1f7 100644 --- a/templates/tags/single.html +++ b/templates/tags/single.html @@ -14,7 +14,7 @@ {%- set description = config.description %} - {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} + {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} {%- endblock seo %} {%- block content %} |
