diff options
author | digitalcraftsman <digitalcraftsman@protonmail.com> | 2016-11-19 16:46:13 +0300 |
---|---|---|
committer | digitalcraftsman <digitalcraftsman@protonmail.com> | 2016-11-19 16:46:13 +0300 |
commit | f23e973f7f1891e8c95dbce616944b6dce6e71dc (patch) | |
tree | 75cb182dc92007f8e94d7d29702ac72dc0afacd5 | |
parent | 183566a4ebd4f64f631d3ea5f429da3881f52a95 (diff) |
Improve linking of assets and pages
-rw-r--r-- | layouts/partials/article_header.html | 8 | ||||
-rw-r--r-- | layouts/partials/footer.html | 2 | ||||
-rw-r--r-- | layouts/partials/footer_js.html | 4 | ||||
-rw-r--r-- | layouts/partials/head.html | 18 | ||||
-rw-r--r-- | layouts/partials/pagination.html | 8 | ||||
-rw-r--r-- | layouts/partials/social.html | 1 | ||||
-rw-r--r-- | layouts/partials/widgets/categories.html | 5 | ||||
-rw-r--r-- | layouts/partials/widgets/recent_articles.html | 3 | ||||
-rw-r--r-- | layouts/partials/widgets/tag_cloud.html | 5 | ||||
-rw-r--r-- | layouts/partials/widgets/tags.html | 5 |
10 files changed, 32 insertions, 27 deletions
diff --git a/layouts/partials/article_header.html b/layouts/partials/article_header.html index 0e4692c..b70d5a3 100644 --- a/layouts/partials/article_header.html +++ b/layouts/partials/article_header.html @@ -16,14 +16,15 @@ {{ with .Site.Data.l10n.articles.readingtime }}{{.}}{{end}} </div> - + {{ if isset .Params "categories" }} {{ $categoriesLen := len .Params.categories }} {{ if gt $categoriesLen 0 }} <div class="article-category"> <i class="fa fa-folder"></i> {{ range $k, $v := .Params.categories }} - <a class="article-category-link" href="{{ $.Site.BaseURL }}categories/{{ . | urlize | lower }}">{{ . }}</a> + {{ $url := printf "%s/%s" "categories" (. | urlize | lower) }} + <a class="article-category-link" href="{{ $url }}">{{ . }}</a> {{ if lt $k (sub $categoriesLen 1) }}·{{ end }} {{ end }} </div> @@ -36,7 +37,8 @@ <div class="article-category"> <i class="fa fa-tags"></i> {{ range $k, $v := .Params.tags }} - <a class="article-category-link" href="{{ $.Site.BaseURL }}tags/{{ . | urlize | lower }}">{{ . }}</a> + {{ $url := printf "%s/%s" "tags" (. | urlize | lower) }} + <a class="article-category-link" href="{{ $url }}">{{ . }}</a> {{ if lt $k (sub $tagsLen 1) }}·{{ end }} {{ end }} </div> diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 0a02103..f7c798a 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -8,4 +8,4 @@ </footer> {{ partial "footer_js" . }} -{{ partial "footer_custom_js" . }}
\ No newline at end of file +{{ partial "footer_custom_js" . }} diff --git a/layouts/partials/footer_js.html b/layouts/partials/footer_js.html index f452985..2249b20 100644 --- a/layouts/partials/footer_js.html +++ b/layouts/partials/footer_js.html @@ -1,6 +1,6 @@ {{ template "_internal/google_analytics.html" . }} -<script src="{{ .Site.BaseURL }}fancybox/jquery.fancybox.pack.js"></script> -<script src="{{ .Site.BaseURL }}js/script.js"></script> +<script src="{{ "fancybox/jquery.fancybox.pack.js" | absURL }}"></script> +<script src="{{ "js/script.js" | absURL }}"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> {{ range .Site.Params.custom_js }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 6e101d0..2348be8 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -11,17 +11,17 @@ {{ else }} <meta name="description" content="{{ .Site.Params.site_description }}"> {{ end }} - {{ if .RSSLink }} - <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" /> - <link href="{{ .RSSLink }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}" /> + {{ with .RSSLink }} + <link href="{{ . }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" /> + <link href="{{ . }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}" /> {{ end }} <link rel="canonical" href="{{ .Permalink }}"/> - <link rel="icon" href="{{ .Site.BaseURL }}favicon.ico"> - <link rel="apple-touch-icon" href="{{ .Site.BaseURL }}apple-touch-icon.png" /> - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/style.css"> - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/font-awesome.min.css"> - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/monokai.css"> - <link rel="stylesheet" href="{{ .Site.BaseURL }}fancybox/jquery.fancybox.css"> + <link rel="icon" href="{{ "favicon.ico" | absURL }}"> + <link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | absURL }}"/> + <link rel="stylesheet" href="{{ "css/style.css" | absURL }}"> + <link rel="stylesheet" href="{{ "css/font-awesome.min.css" | absURL }}"> + <link rel="stylesheet" href="{{ "css/monokai.css" | absURL }}"> + <link rel="stylesheet" href="{{ "fancybox/jquery.fancybox.css" | absURL }}"> {{ range .Site.Params.custom_css }} <link rel="stylesheet" href="{{ . | absURL }}"> {{ end }} diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html index 74024d7..b285e0c 100644 --- a/layouts/partials/pagination.html +++ b/layouts/partials/pagination.html @@ -1,13 +1,13 @@ <nav id="page-nav"> {{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} {{ if .Paginator.HasPrev }} - <a class="extend prev" rel="prev" href="{{ .Site.BaseURL }}{{.Paginator.Prev.URL}}"> - « {{with .Site.Data.l10n.pagination.previous}}{{.}}{{end}} + <a class="extend prev" rel="prev" href="{{ .Paginator.Prev.URL | absURL }}"> + « {{ with .Site.Data.l10n.pagination.previous }}{{ . }}{{ end }} </a> {{ end }} {{ if .Paginator.HasNext }} - <a class="extend next" rel="next" href="{{ .Site.BaseURL }}{{.Paginator.Next.URL}}"> - {{with .Site.Data.l10n.pagination.next}}{{.}}{{end}} » + <a class="extend next" rel="next" href="{{ .Paginator.Next.URL | absURL }}"> + {{ with .Site.Data.l10n.pagination.next }}{{ . }}{{ end }} » </a> {{ end }} {{ end }} diff --git a/layouts/partials/social.html b/layouts/partials/social.html index 58fe7a2..f1eee38 100644 --- a/layouts/partials/social.html +++ b/layouts/partials/social.html @@ -6,7 +6,6 @@ <td><a href="//gitlab.com/u/{{.}}" target="_blank" title="GitLab"><i class="fa fa-gitlab"></i></a></td> {{ end }} - {{ with .Site.Social.bitbucket }} <td><a href="//bitbucket.com/{{.}}" target="_blank" title="Bitbucket"><i class="fa fa-bitbucket"></i></a></td> {{ end }} diff --git a/layouts/partials/widgets/categories.html b/layouts/partials/widgets/categories.html index 566a2ae..6ec7f9c 100644 --- a/layouts/partials/widgets/categories.html +++ b/layouts/partials/widgets/categories.html @@ -7,7 +7,8 @@ <ul class="category-list"> {{ range $name, $items := .Site.Taxonomies.categories }} <li class="category-list-item"> - <a class="category-list-link" href="{{ $.Site.BaseURL }}categories/{{ $name | urlize | lower }}"> + {{ $url := printf "%s/%s" "categories" ($name | urlize | lower)}} + <a class="category-list-link" href="{{ $url | absURL }}"> {{ $name }} </a> <span class="category-list-count">{{ len $items }}</span> @@ -18,4 +19,4 @@ </div> {{ end }} {{ end }} -{{ end }}
\ No newline at end of file +{{ end }} diff --git a/layouts/partials/widgets/recent_articles.html b/layouts/partials/widgets/recent_articles.html index d765220..5ea84d8 100644 --- a/layouts/partials/widgets/recent_articles.html +++ b/layouts/partials/widgets/recent_articles.html @@ -20,7 +20,8 @@ {{ if isset .Params "categories" }} {{ if gt (len .Params.categories) 0 }} <p class="item-category"> - <a class="article-category-link" href="{{ $.Site.BaseURL }}categories/{{ index .Params.categories 0 | urlize | lower }}"> + {{ $url := printf "%s/%s" "categories" (index .Params.categories 0 | urlize | lower)}} + <a class="article-category-link" href="{{ $url | absURL }}"> {{ index .Params.categories 0 }} </a> </p> diff --git a/layouts/partials/widgets/tag_cloud.html b/layouts/partials/widgets/tag_cloud.html index 5bfd5da..e2bc7a7 100644 --- a/layouts/partials/widgets/tag_cloud.html +++ b/layouts/partials/widgets/tag_cloud.html @@ -7,10 +7,11 @@ </h3> <div class="widget tagcloud"> {{ range $name, $items := .Site.Taxonomies.tags }} - <a href="{{ $.Site.BaseURL }}tags/{{ $name | urlize | lower }}" style="font-size: 12px;">{{ $name }}</a> + {{ $url := printf "%s/%s" "tags" ($name | urlize | lower)}} + <a href="{{ $url | absURL }}" style="font-size: 12px;">{{ $name }}</a> {{ end }} </div> </div> {{ end }} {{ end }} -{{ end }}
\ No newline at end of file +{{ end }} diff --git a/layouts/partials/widgets/tags.html b/layouts/partials/widgets/tags.html index cf97e36..9d03746 100644 --- a/layouts/partials/widgets/tags.html +++ b/layouts/partials/widgets/tags.html @@ -9,7 +9,8 @@ <ul class="category-list"> {{ range $name, $items := .Site.Taxonomies.tags }} <li class="category-list-item"> - <a class="category-list-link" href="{{ $.Site.BaseURL }}tags/{{ $name | urlize | lower }}"> + {{ $url := printf "%s/%s" "tags" ($name | urlize | lower)}} + <a class="category-list-link" href="{{ $url | absURL }}"> {{ $name }} </a> <span class="category-list-count">{{ len $items }}</span> @@ -20,4 +21,4 @@ </div> {{ end }} {{ end }} -{{ end }}
\ No newline at end of file +{{ end }} |