diff options
author | Ralf Geschke <ralf@kuerbis.org> | 2018-12-18 00:27:08 +0300 |
---|---|---|
committer | Ralf Geschke <ralf@kuerbis.org> | 2018-12-18 00:27:08 +0300 |
commit | c8ebdd3d905f239abd7fa4ba133f188c7d553558 (patch) | |
tree | 99dce21e0be3377090a183acde64cc2a6b9ac1b2 | |
parent | cd998567052ba66218c9d7083bef87636b40c6b9 (diff) |
Add new partial to include files in the head section (e.g. to add CSS/JavaScript in the static folder)v0.2.2
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | exampleSite/layouts/partials/head_includes.html | 14 | ||||
-rw-r--r-- | layouts/partials/head.html | 2 | ||||
-rw-r--r-- | layouts/partials/head_includes.html | 14 | ||||
-rw-r--r-- | layouts/partials/header.html | 39 |
5 files changed, 36 insertions, 39 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fd360a4..bfb1883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.2.2 - 2018-12-17 + +### Added + +- New (placeholder) partial to add CSS or JavaScript files in the head section. If you want to integrate additional CSS or JavaScript files, you can use the static files folder. To include some files, place a file "head_includes.html" into your site's folder "layouts/partials/" and add the necessary HTML code. An example is included in the `exampleSite` folder (see [head_includes.html](https://github.com/geschke/hugo-tikva/blob/master/exampleSite/layouts/partials/head_includes.html) ). + ## 0.2.1 - 2018-12-17 ### Changed diff --git a/exampleSite/layouts/partials/head_includes.html b/exampleSite/layouts/partials/head_includes.html new file mode 100644 index 0000000..0d17e80 --- /dev/null +++ b/exampleSite/layouts/partials/head_includes.html @@ -0,0 +1,14 @@ +<!-- Placeholder template file + +If you want to add CSS or JavaScript files from the site's static folder, copy this file into the site's folder +layouts/partials/ . +Then add the URLs to your files as in the following example below this HTML comment. You can use Hugo's template engine +with variables and all the nice functions as usual. + +Example: + The CSS file is found in: <site-folder>/static/css/site.css + +This can be added to your website with: + <link href="{{ .Site.BaseURL }}css/site.css" rel="stylesheet"> + +--> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a83cae4..dbeea43 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -285,12 +285,14 @@ body { } </style> {{ end }} + {{ end }} {{ "<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->" | safeHTML }} {{ "<!--[if lt IE 9]>" | safeHTML }} <script src="//oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="//oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> {{ "<![endif]-->" | safeHTML }} +{{- partial "head_includes.html" . }} {{- partial "javascript_header.html" . }} </head>
\ No newline at end of file diff --git a/layouts/partials/head_includes.html b/layouts/partials/head_includes.html new file mode 100644 index 0000000..0d17e80 --- /dev/null +++ b/layouts/partials/head_includes.html @@ -0,0 +1,14 @@ +<!-- Placeholder template file + +If you want to add CSS or JavaScript files from the site's static folder, copy this file into the site's folder +layouts/partials/ . +Then add the URLs to your files as in the following example below this HTML comment. You can use Hugo's template engine +with variables and all the nice functions as usual. + +Example: + The CSS file is found in: <site-folder>/static/css/site.css + +This can be added to your website with: + <link href="{{ .Site.BaseURL }}css/site.css" rel="stylesheet"> + +--> diff --git a/layouts/partials/header.html b/layouts/partials/header.html deleted file mode 100644 index 98a0155..0000000 --- a/layouts/partials/header.html +++ /dev/null @@ -1,39 +0,0 @@ -<nav class="navbar fixed-top navbar-expand-lg {{ .Site.Params.Navbar.ColorScheme }} {{ .Site.Params.Navbar.BgScheme }}"> - <a class="navbar-brand" href="{{ .Site.BaseURL }}">{{ if .Site.Params.Navbar.BrandImage }}<img src="{{ .Site.BaseURL }}{{ .Site.Params.Navbar.BrandImage }}" width="30" height="30" class="d-inline-block align-top" alt=""> {{ end }}{{ .Site.Title }}</a> - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarMain" aria-controls="navbarMain" - aria-expanded="false" aria-label="Toggle navigation"> - <span class="navbar-toggler-icon"></span> - </button> - - <div class="collapse navbar-collapse" id="navbarMain"> - <ul class="navbar-nav mr-auto"> - {{ $currentPage := . }} - {{ range .Site.Menus.main }} - {{ if .HasChildren }} - <li class="nav-item dropdown {{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}"> - <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" - aria-expanded="false"> - {{ .Pre }} - {{ .Name }} - </a> - <div class="sub-menu dropdown-menu" aria-labelledby="navbarDropdown"> - {{ range .Children }} - - <a class="dropdown-item" href="{{ .URL }}">{{ .Name }}</a> - {{ end }} - </div> - </li> - <span class="mx-2"></span> - {{ else }} - <li class="nav-item {{ if eq $currentPage.URL .URL }}active{{ end }}"> - <a class="nav-link" href="{{ .URL }}"> - {{ .Pre }} - {{ .Name }} - </a> - </li> - <span class="mx-2"></span> - {{ end }} - {{ end }} - - </ul> -</nav>
\ No newline at end of file |