diff options
author | parsiya <parsiya@gmail.com> | 2018-09-03 01:14:11 +0300 |
---|---|---|
committer | parsiya <parsiya@gmail.com> | 2018-09-03 01:14:11 +0300 |
commit | 63c9b5b24aa58dc77405222b18a40e99821a1231 (patch) | |
tree | a7cc9a292fc0b7389bf65a557c6b690d9495e46f | |
parent | 78ec905f19f537199d82d20eb16c7132b023034e (diff) |
Clean up partials and shortcodes
-rw-r--r-- | layouts/_default/single.html | 1 | ||||
-rwxr-xr-x | layouts/partials/custom_twitter_card.html | 2 | ||||
-rw-r--r-- | layouts/partials/header.html | 7 | ||||
-rw-r--r-- | layouts/partials/navigation.html | 4 | ||||
-rw-r--r-- | layouts/partials/octo-header.html | 4 | ||||
-rw-r--r-- | layouts/partials/pagination.html | 9 | ||||
-rw-r--r-- | layouts/partials/post_footer.html | 18 | ||||
-rw-r--r-- | layouts/partials/post_header.html | 6 | ||||
-rw-r--r-- | layouts/partials/sidebar.html | 12 | ||||
-rw-r--r-- | layouts/shortcodes/codecaption.html | 19 | ||||
-rw-r--r-- | layouts/shortcodes/imgcap.html | 18 |
11 files changed, 51 insertions, 49 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 994cbd7..6e4de67 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -11,7 +11,6 @@ <div class="entry-content"> <!-- insert table of contents if it is set either in the config file or in the frontmatter - frontmatter has priority --> {{ $.Scratch.Set "pagetoc" .TableOfContents }} - <!-- the isset here is working properly becasue everything is lower case --> {{ if or (and (isset .Params "toc") (eq .Params.toc true)) (and (not (isset .Params "toc")) (eq .Site.Params.tableOfContents true)) }} {{ $.Scratch.Get "pagetoc" }} {{ end }} diff --git a/layouts/partials/custom_twitter_card.html b/layouts/partials/custom_twitter_card.html index f805a59..b056583 100755 --- a/layouts/partials/custom_twitter_card.html +++ b/layouts/partials/custom_twitter_card.html @@ -9,7 +9,7 @@ {{ end }} <!-- Twitter Card data --> <meta name="twitter:title" content="{{ .Title }}"/> - <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"/> + <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"/> {{ with .Site.Params.twitterCardSite }}<meta name="twitter:site" content="@{{ . }}"/>{{ end }} {{ with .Site.Params.twitterCardDomain }}<meta name="twitter:domain" content="{{ . }}"/>{{ end }} {{ with .Site.Params.twitterCardAuthor }}<meta name="twitter:creator" content="@{{ . }}"/>{{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index de38c7a..9bd9457 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -41,17 +41,14 @@ <link href="{{ "/favicon.png" | absURL }}" rel="icon"> <!-- RSS --> - {{ $siteTitle := .Site.Title }} - {{ $authorName := .Site.Author.name }} - - {{ with .RSSLink }}<link href="{{ . }}" rel="alternate" type="application/rss+xml" title="{{ $siteTitle }}" />{{ end }} + {{ with .RSSLink }}<link href="{{ . }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" />{{ end }} <meta name="description" content="{{ if ne .Description "" }}{{ .Description }}{{ else }}{{ .Site.Params.defaultDescription }}{{ end }}"> <meta name="keywords" content="{{ range $index, $element := .Keywords }}{{ if gt $index 0 }},{{ end }}{{ . }}{{ else }}{{ .Site.Params.defaultKeywords }}{{ end }}"> <meta name="author" content="{{ .Site.Params.author }}"> - <!-- outputs the generator version for usage tacking --> + <!-- Generator version for usage tacking --> {{ .Hugo.Generator }} <!-- Google Analytics --> diff --git a/layouts/partials/navigation.html b/layouts/partials/navigation.html index c371715..45831c5 100644 --- a/layouts/partials/navigation.html +++ b/layouts/partials/navigation.html @@ -1,12 +1,11 @@ <!-- mobile navigation --> <fieldset class="mobile-nav"> - <!-- this needs JavaScript but works until I manage to make one with CSS without wrecking the site --> + <!-- Apart from Disqus, this is the only place where we need JavaScript. --> <select onchange="location = this.value;"> <option value="">Navigate…</option> {{ range .Site.Menus.main }} <option value="{{ .URL | absURL }}">» {{ .Name }}</option> {{ end }} -<!-- <option value="{{ "/index.xml" | absURL }}">» RSS</option> --> </select> </fieldset> @@ -22,7 +21,6 @@ {{ end }} </ul> -<!-- http://fontawesome.io icon fa-lg adapts it to size (at least it is supposed to) --> <ul class="subscription"> {{ if or .Site.Params.rss .Site.Params.textrss }} {{ if .Site.Params.rss }} diff --git a/layouts/partials/octo-header.html b/layouts/partials/octo-header.html index ece9d09..5a0fae2 100644 --- a/layouts/partials/octo-header.html +++ b/layouts/partials/octo-header.html @@ -1,5 +1,7 @@ +<!-- Octopress header partial --> <hgroup> - <!-- Remember that .Title will refer to the title of the specific page. For index it is the .Site.Title but is different for individual pages --> + <!-- Remember that .Title will refer to the title of the specific page. + For index it's .Site.Title but is different for individual pages --> <h1><a href="{{ "/" | absURL }}">{{ .Site.Title }}</a></h1> <h2>{{ .Site.Params.subtitle }}</h2> </hgroup>
\ No newline at end of file diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html index 8efbd91..de234f9 100644 --- a/layouts/partials/pagination.html +++ b/layouts/partials/pagination.html @@ -1,6 +1,9 @@ -<!-- copy pasted from tpl/template_embedded.go --> -<!-- default pagination.html creates <ul class="pagination"> and then a list of links for counters, forwardw and backward - while Octopress uses <div class="pagination"> and links inside--> +<!-- Pagination partial for index --> +<!-- Modified tpl/template_embedded.go --> + +<!-- default pagination.html creates <ul class="pagination"> and then a list of + links for counters, forward and backward while Octopress uses + <div class="pagination"> and links inside--> {{ $pag := $.Paginator }} {{ if gt $pag.TotalPages 1 }} diff --git a/layouts/partials/post_footer.html b/layouts/partials/post_footer.html index b87f847..43046ac 100644 --- a/layouts/partials/post_footer.html +++ b/layouts/partials/post_footer.html @@ -1,4 +1,5 @@ -<!-- This file contains the footer for each post - do not mistake it with page footer which is in footer.html partial --> +<!-- This file contains the footer for each post + - different from page footer which is in footer.html partial --> <footer> <p class="meta"> @@ -14,14 +15,13 @@ </span> </p> - <!-- For sharing stuff --> - <!-- <div class="sharing"> </div> --> - - <!-- PrevInSection and nextInSection point to previous and next page in the same section, in this case "post" - this way we won't see other pages. - If you don't like it, use .Prev and .Next - if you want to use .Prev and .Next keep in mind that as of Hugo v0.15 they work the other way around - meaning that .Prev needs to go to right which will point to the next post and .Next will go to left and will post to previous post - strange - This does not happen with InSection ones + <!-- PrevInSection and nextInSection point to previous and next page in the + same section, in this case "post" this way we won't see other pages. + If you don't like it, use .Prev and .Next. If you want to use .Prev and + .Next keep in mind that as of Hugo v0.15 they work the other way around + meaning that .Prev needs to go to right which will point to the next post + and .Next will go to left and will post to previous post. + This does not happen with InSection ones. For more info about template variables: https://gohugo.io/templates/variables/ --> <p class="meta"> diff --git a/layouts/partials/post_header.html b/layouts/partials/post_header.html index 81af322..7b2bede 100644 --- a/layouts/partials/post_header.html +++ b/layouts/partials/post_header.html @@ -1,4 +1,4 @@ -<!-- This file contains the header/title for each post --> +<!-- Partial that geenrates the header/title for each post --> <header> <p class="meta">{{ .Date.Format "Jan 2, 2006" }} @@ -6,8 +6,8 @@ {{ if .Site.DisqusShortname }} - <a href="{{ .Permalink }}#disqus_thread">Comments</a>{{ end }} {{ if isset .Params "categories" }} - <!-- <br/> this will make the categories go to the second line and mess with the title --> - <!-- in order to make category URLs work, we need to urlize them and then convert them to lowercase + <!-- in order to make category URLs work, we need to urlize them and + convert them to lowercase e.g. .NET Remoting -urlize-> .NET-Remoting -lowercase-> .net-remoting --> - {{ range .Params.categories }}<a class="label" href="{{ "/categories/" | absURL }}{{ . | urlize | lower }}/">{{ . }} </a>{{ end }} {{ end }} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 2e672c0..4e708b7 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -1,4 +1,4 @@ -<!-- to modify sidebar width check the css file lines 757 and 765 (for large screens) --> +<!-- To modify sidebar width check the css file lines 757 and 765 (for large screens) --> <aside class="sidebar thirds"> <section class="first odd"> @@ -40,13 +40,13 @@ {{ with .Site.Params.instagram }}<a target="_blank" href="{{ . }}" title="{{ . }}"><i class="fa fa-instagram fa-3x"></i></a>{{ end }} {{ with .Site.Params.bitcoin }}<a target="_blank" href="{{ . }}" title="{{ . }}"><i class="fa fa-bitcoin fa-3x"></i></a>{{ end }} - <!-- don't need RSS here anymore --> + <!-- Uncomment to add the RSS icon --> <!-- {{ if .Site.Params.rss }}<a href="{{ "/index.xml" | absURL }}" type="application/rss+xml" title="RSS"><i class="fa fa-rss-square fa-3x"></i></a>{{ end }} --> </li> </ul> - <!-- sidebar menu - items are read from the config file - first we check if it is enabled in config file and then start adding the items + <!-- Sidebar menu - items are read from the config file + first we check if it is enabled in config file and then start adding items. if Site.Params.sidebarNewWindow exists and is set to true then open these links in a new window --> {{ with .Site.Params.sidebarMenuEnabled }} @@ -64,8 +64,8 @@ {{ end }} {{ end }} - <!-- add recent posts - limit is .Site.Params.sidebarRecentLimit - example copied from https://gohugo.io/templates/go-templates/ --> - <!-- only display this section if sideBarRecentLimit is not zero --> + <!-- Add recent posts - limit is .Site.Params.sidebarRecentLimit - example copied from https://gohugo.io/templates/go-templates/ --> + <!-- Only display this section if sideBarRecentLimit is not zero --> {{ with .Site.Params.sidebarRecentLimit }} {{ if not (eq . 0) }} <section class="even"> diff --git a/layouts/shortcodes/codecaption.html b/layouts/shortcodes/codecaption.html index 6048378..52b7a34 100644 --- a/layouts/shortcodes/codecaption.html +++ b/layouts/shortcodes/codecaption.html @@ -1,11 +1,18 @@ -<!-- codecaption short code - basically this is normal highlighted code with caption on top - example usage (Hugo seems to ignore stuff in this): +<!-- Author: Parsia Hakimian https://github.com/parsiya/Hugo-Shortcodes --> - { { < codecaption lang="language e.g. python/csharp" title="captiontitle" > } } +<!-- codecaption short code - basically this is normal highlighted code with caption on top. - code to be highlighted + Usage: - { { < /codecaption > } } --> + {{< codecaption lang="language e.g. python/csharp" title="captiontitle" >}} + package main + + import "fmt" + + func main() { + fmt.Println("Hello World!") + } + {{< /codecaption >}} --> <figure class="code"> <figcaption> @@ -14,4 +21,4 @@ <div class="codewrapper"> {{ highlight (trim .Inner "\n\r") (.Get "lang") "linenos=true" }} </div> -</figure> +</figure>
\ No newline at end of file diff --git a/layouts/shortcodes/imgcap.html b/layouts/shortcodes/imgcap.html index 2f5c109..7b0b183 100644 --- a/layouts/shortcodes/imgcap.html +++ b/layouts/shortcodes/imgcap.html @@ -1,23 +1,19 @@ +<!-- Author: Parsia Hakimian https://github.com/parsiya/Hugo-Shortcodes --> + <!-- normal image with caption sample usage: - { { < imgcap title="figurecaption" src="imagesrc" > } } + {{< imgcap title="figurecaption" src="imagesrc" >}} - { { < imgcap title="this is a tree" src="/images/2016/gardening/tree1.jpg" > } } + {{< imgcap title="this is a tree" src="/images/2016/gardening/tree1.jpg" >}} - alt and title and caption will be the same + alt text and title and caption will be the same. + Images can be referenced from the static directory or from the page bundle. --> -<!-- <figure class="imagecaption"> - <img class="caption" title="{{ .Get "title" }}" alt="{{ .Get "title" }}" src="{{ .Get "src" }}"></img> - <figcaption> - <span class="caption-text">{{ .Get "title" }}</span> - </figcaption> -</figure> --> - -<!-- imitates the imgcap plugin from Octopress - --> +<!-- imitates the imgcap plugin from Octopress --> <span class="caption-wrapper"> |