diff --git a/.gitignore b/.gitignore index 73d51d7..a1fa0f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /public/ /exampleSite/public/ -/exampleSite/resources/_gen/ +/exampleSite/resources/_gen/* workspace diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d0552ae --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,12 @@ +## Contributing + +Contributions are welcome! Fork this repo and create a merge request if you implemented a feature or a bug fix that everyone can profit from. + +The necessary requirements for merge requests are: +1. Theme should be kept leightweight +2. Keep it modular: New features should be made optional if possible or if they influence performance in any way +3. Document your changes; most importantly your config changes in **config.toml** (if there are any) + +## License + +This theme is released under the Apache 2.0 license, just like its predecessor. For more information read the [license](https://github.com/kdevo/osprey-delight/blob/master/LICENSE.md). \ No newline at end of file diff --git a/CUSTOMIZING.md b/CUSTOMIZING.md new file mode 100644 index 0000000..8e97abe --- /dev/null +++ b/CUSTOMIZING.md @@ -0,0 +1,36 @@ +# Customizing + +Osprey Delight makes heavy use of various Hugo features, e.g. directly benefits from Hugo's virtual file system and [directory structure](https://gohugo.io/getting-started/directory-structure/), [partials](https://gohugo.io/templates/partials/), as well as using the awesome [Hugo Pipes](https://gohugo.io/hugo-pipes/) whenever it makes sense. + +This also means that you normally do not need to maintain a separate fork. If you have built something nice, don't be afraid to share the customization via [PR](https://github.com/kdevo/osprey-delight/pulls), so that others can profit from it, too. :rocket: + +## Custom SCSS + +Place a file named `_custom.scss` in your `assets/sass/` folder (create the directories if needed). This will override the theme's `_custom.scss` which is loaded in the internal main SCSS. + +> The theme's built-in `_custom.scss` contains useful customization examples, so don't be afraid to copy, override and experiment with it. + +### Theming + +Coming soon. +Take a look at [the themes directory](themes/osprey-delight/assets/sass/themes) for a sneak peek! + +### Syntax Highlighting (for Blog) + +Limiting external dependencies is important when it comes performance, therefore only Hugo's internal [Chroma Syntax Highlighting](https://gohugo.io/content-management/syntax-highlighting/) is supported. Here's how to use it: + +1. Generate a Chromastyle of your choice (in this case `solarized-dark`) as `_custom.scss` in project root: `hugo gen chromastyles --style=solarized-dark > _custom.scss` +2. Move the file to `assets/sass/` folder +3. Add `pygmentsUseClasses = true` to your config.yaml + +> Refer to [the official Hugo documentation](https://gohugo.io/content-management/syntax-highlighting/) for more info. + +## Custom templates + +### Extent the head + +In case you want to load custom HTML for additional scripts etc. inside the page's `head`: Place a file named `head-extended.html` in your `layouts/partials/` folder (create the directories if needed). This file can e.g. contain additional ` - +{{ $buildOptions := dict "minify" true "target" "es2015" }} +{{ if .IsHome }} + {{ $scripts := slice }} + {{ $scripts = $scripts | append (resources.Get "js/src/base.js") }} + + {{ if .Site.Params.Feat.useTermynal -}} + {{ $scripts = $scripts | append (resources.Get "js/src/termynal.js" | resources.ExecuteAsTemplate "js/src/termynal.js" .) }} + {{- end }} + + {{ if not (eq (len (where .Site.RegularPages "Section" "gallery")) 0) -}} + {{ $scripts = $scripts | append (resources.Get "js/src/modal.js" | resources.ExecuteAsTemplate "js/src/modal.js" .) }} + {{- end }} + + {{ $scripts = $scripts | append (resources.Get "js/src/nav.js" | resources.ExecuteAsTemplate "js/src/nav.js" .) }} + {{ $scripts = $scripts | append (resources.Get "js/src/home.js") }} + + {{ if (.Site.Params.Feat.ajaxBasin) -}} + {{ $scripts = $scripts | append (resources.Get "js/src/contact.js" | resources.ExecuteAsTemplate "js/src/contact.js" .) }} + {{- end }} + {{ $content := ($scripts | resources.Concat "js/bundle-home.js" | js.Build $buildOptions).Content }} + {{ if (gt (len $content) 6144) -}} {{ warnf "Performance: inlined JS is %dKB" (len $content) }} {{- end }} + {{- else -}} - - -{{- end }} + {{ $scripts := slice (resources.Get "js/src/base.js") (resources.Get "js/src/nav.js") }} + {{ $content := ($scripts | resources.Concat "js/bundle-blog.js" | js.Build $buildOptions).Content }} + +{{ end }} diff --git a/layouts/partials/body-top.html b/layouts/partials/body-top.html index 787ecb2..fa854a6 100644 --- a/layouts/partials/body-top.html +++ b/layouts/partials/body-top.html @@ -6,36 +6,58 @@ {{ end }} {{ if .IsHome }} -
+
-
-
-
-
-
-

{{ .Site.Params.tagline | markdownify }}|

+ {{ partial "logo-img.html" . }} + {{ with .Site.Params.mdTagline -}} + {{ (replace (. | markdownify) "{cursor}" "|") | safeHTML }} + {{- else -}} +

{{ .Site.Params.tagline }}|

+ {{- end }}
-
-
{{ end }} -