Skip to content

Commit

Permalink
Merge pull request #11 from MJacred/smallfixes
Browse files Browse the repository at this point in the history
v2.0.1
  • Loading branch information
MJacred authored Jan 31, 2023
2 parents 183f274 + 65aa7c1 commit f47a945
Show file tree
Hide file tree
Showing 49 changed files with 88 additions and 30 deletions.
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@ All notable changes to this project (since its fork) are documented in this file
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).


## [2.x] - 2023-xx-xx
## [2.0.1] - 2023-01-31

### Added

* Support including website's custom javascript (see README.md)
* Support merging website's custom styling into theme's styling (see README.md)

### Changed

### Changed

### Deprecated
* Moved `static/images` to subfolder exampleSite.


### Removed

* `images/` folder.


### Fixed


### Security
* Placement of cookie notification: now truly stays at the window's bottom.
* Defined `sameSite` value for cookies (web browser was showing warnings).


## [2.0] - 2023-01-20
Expand Down
22 changes: 19 additions & 3 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,26 @@ Files: *
Comment: Hugo Invi
Copyright: 2018, lucperkins.
2019-2022, Stefan M..
2022, Cubiest.
2022-2023, Cubiest.
License: Expat

Files: ./assets/bulma/*
Comment: Bulma
Copyright: 2022, Jeremy Thomas.
Copyright: 2023, Jeremy Thomas.
License: Expat
Source: https://github.com/jgthms/bulma

Files: ./static/images/logos/made-with-bulma.png
Comment: Bulma
Copyright: 2023, Jeremy Thomas.
License: Expat
Source: https://github.com/jgthms/bulma

Files: ./static/images/loaders/rings.svg
Comment: SVG-Loaders
Copyright: 2014, Sam Herbert.
License: Expat
Source: https://github.com/SamHerbert/SVG-Loaders

Files: ./static/webfonts/fa-*
./static/css/brands.*
Expand All @@ -46,24 +59,27 @@ to represent the company, product, or service to which they refer**.
Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: Expat.
Copyright: 2022, Fonticons Inc.
License: CC-BY-4.0, OFL-1.1, Expat
Source: https://github.com/FortAwesome/Font-Awesome

Files: ./static/modules/jquery-3.6.1.min.js
Comment: jQuery.
Copyright: 2022, OpenJS Foundation and other contributors
License: Expat
Source: https://github.com/jquery/jquery

Files: ./static/modules/photoswipe
Comment: PhotoSwipe Lightbox 5.3.3.
Copyright: 2014-2022, Dmitry Semenov
License: Expat
Source: https://github.com/dimsemenov/PhotoSwipe

Files: ./static/modules/js.cookie.*
Comment: js-cookie v3.0.1.
Copyright: 2018, Klaus Hartl.
2018, Fagner Brack.
2018, GitHub Contributors.
License: Expat

Source: https://github.com/js-cookie/js-cookie/

License: Expat
Permission is hereby granted, free of charge, to any person obtaining
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MIT License

Copyright (c) 2018 lucperkins
Copyright (c) 2019 - November 2022 Stefan M.
Copyright (c) December 2022 Cubiest
Copyright (c) December 2022 - 2023 Cubiest

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ Visual

## Usage

### Custom Javascript

* Write custom javascript and declare the path in config file using `params.customJS`
* layouts/partials/javascript.html will fetch and insert it in each page including this partial (as of now: `baseof.html`, `single.html`)


### Merge Project styling with this theme

* Write custom sass file in your `assets` folder and declare the path in config file using `params.customCSS`
* The styling will be merged with this theme


### Content Shortcodes

[Hugo Docs](https://gohugo.io/content-management/shortcodes/)
Expand Down
3 changes: 2 additions & 1 deletion assets/invi/partials/_cookies.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#cookie-notification {
background-color: $cp-container-5;
position: sticky;
position: fixed;
width: 100%;
bottom: 0;
padding: 8px;
}
Expand Down
6 changes: 3 additions & 3 deletions assets/invi/partials/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Sidebar Styles
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid $cp-container-3; // FIXME: lighten($cp-container-3, 5%); -> variable is hex string, not color
border-bottom: 1px solid $cp-container-3; // FIXME (https://github.com/gohugoio/hugo/issues/10632): lighten($cp-container-3, 5%); -> variable is hex string, not color
padding: 0 20px;

img {
Expand Down Expand Up @@ -160,9 +160,9 @@ Sidebar Styles

li {
a {
background-color: $cp-container-3; // FIXME: darken($cp-container-3, 5%); -> variable is hex string, not color
background-color: $cp-container-3; // FIXME (https://github.com/gohugoio/hugo/issues/10632): darken($cp-container-3, 5%); -> variable is hex string, not color
padding-left: 62px;
border-bottom: 1px solid $cp-container-3-border;// FIXME: lighten($cp-container-3-border, 2%); -> variable is hex string, not color
border-bottom: 1px solid $cp-container-3-border;// FIXME (https://github.com/gohugoio/hugo/issues/10632): lighten($cp-container-3-border, 2%); -> variable is hex string, not color
font-size: .8rem;

&:hover {
Expand Down
9 changes: 9 additions & 0 deletions exampleSite/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,15 @@ params:
# Default width/height. Uncomment if you need to change
# width: 112
# height: 28
# ------------------------------------------
# Theme Override
# ------------------------------------------
customJS:
- "js/main.js"
customCSS: "/css/style.sass"
# ------------------------------------------
# Theme Color Palette
# ------------------------------------------
style:
# base colors
# cp_base_primary: '#4fc1ea'
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed images/screenshot.png
Diff not rendered.
Binary file removed images/tn.png
Diff not rendered.
36 changes: 26 additions & 10 deletions layouts/partials/css.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
{{- $inServerMode := .Site.IsServer }}
{{- $sass := "style.sass" }}
{{- $cssTarget := "css/style.css" }}
{{- $cssOpts := cond ($inServerMode) (dict "targetPath" $cssTarget "enableSourceMap" true "transpiler" "libsass" "vars" site.Params.style) (dict "targetPath" $cssTarget "outputStyle" "compressed" "transpiler" "libsass" "vars" site.Params.style) }}
<link rel="icon" type="image/png" href="{{ "images/favicon.png" | relURL }}" />
<!-- bulma, fresh start -->
{{- $inServerMode := .Site.IsServer }}
<!-- bulma, invi, custom css start -->
{{- $inviCSSTarget := "css/style.css" }}
{{ if .Site.Params.customCSS }}
{{- $inviCSSTarget = "css/temp_invi_style.css" }}
{{- end }}
{{- $inviCSSOpts := cond ($inServerMode)
(dict "targetPath" $inviCSSTarget "enableSourceMap" true "transpiler" "libsass" "vars" site.Params.style)
(dict "targetPath" $inviCSSTarget "outputStyle" "compressed" "transpiler" "libsass" "vars" site.Params.style)
}}
{{- $inviSass := resources.Get "style.sass" | toCSS $inviCSSOpts }}
{{- $cssResource := $inviSass }}
{{ with .Site.Params.customCSS }}
{{- $customCSSTarget := "css/temp_custom_style.css" }}
{{- $customCSSOpts := cond ($inServerMode)
(dict "targetPath" $customCSSTarget "enableSourceMap" true "transpiler" "libsass" "vars" site.Params.style)
(dict "targetPath" $customCSSTarget "outputStyle" "compressed" "transpiler" "libsass" "vars" site.Params.style)
}}
{{- $customSass := resources.Get . | toCSS $customCSSOpts }}
{{- $cssResource = slice $inviSass $customSass | resources.Concat "css/style.css" }}
{{- end }}
{{- if $inServerMode }}
{{- $css := resources.Get $sass | toCSS $cssOpts }}
<link rel="stylesheet" type="text/css" href="{{ $css.RelPermalink }}">
{{- $css := $cssResource }}
<link rel="stylesheet" type="text/css" href="{{ $css.RelPermalink }}">
{{- else }}
{{- $css := resources.Get $sass | toCSS $cssOpts | minify | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}">
{{- $css := $cssResource | minify }}
<link rel="stylesheet" type="text/css" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}">
{{- end }}
<!-- bulma, fresh end -->
<!-- bulma, invi css end -->
<!-- photoswipe -->
<link rel="stylesheet" type="text/css" href="{{ "modules/photoswipe/photoswipe.css" | relURL }}">
<!-- fontawesome icons start -->
Expand Down
3 changes: 3 additions & 0 deletions layouts/partials/javascript.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<script src={{ "modules/jquery-3.6.1.min.js" | relURL }}></script>
<script type="module" src="{{ "js/invi.js" | relURL }}"></script>
{{ range .Site.Params.customJS }}
<script type="module" src="{{ . | relURL }}"></script>
{{- end }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
9 changes: 3 additions & 6 deletions static/js/invi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ $(document).ready(function () {
var notification = $('#cookie-notification');
if (notification.length) {
var allow_other_cookies = Cookies.get("allow-nonfunctional-website-cookies");
if (allow_other_cookies === null || typeof allow_other_cookies === "undefined") {
// TODO: change html.background-color to `whitesmoke`
} else {
if (allow_other_cookies !== null && typeof allow_other_cookies !== "undefined") {
notification.hide();
}
}
Expand Down Expand Up @@ -213,20 +211,19 @@ $(document).ready(function () {
* @return {boolean} whether to accept cookies beyond the necessary functional ones.
*/
function handleWebsiteCookies(accept) {
Cookies.set("allow-nonfunctional-website-cookies", accept, { expires: 730 }); // i.e. in 2 years
Cookies.set("allow-nonfunctional-website-cookies", accept, { expires: 730, sameSite: 'lax' }); // i.e. in 2 years

var notification = $("#cookie-notification");
if (notification.length) {
notification.hide();
}
// TODO: change html.background-color to `#444F60`
}

/**
* acceptCookiesAndShowYouTubeVideo user clicked on youtube cookie consent button beneath video placeholder.
*/
function acceptCookiesAndShowYouTubeVideo() {
Cookies.set("allow-youtube-cookies", true, { expires: 730 }); // i.e. in 2 years
Cookies.set("allow-youtube-cookies", true, { expires: 730, sameSite: 'lax' }); // i.e. in 2 years

// hide consent notification
var notification = document.getElementsByClassName("video-embed-notification")[0];
Expand Down
2 changes: 1 addition & 1 deletion theme.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# https://github.com/gohugoio/hugoThemesSiteBuilder#theme-configuration
name = "Hugo Invi"
version = "2.0"
version = "2.0.1"
license = "MIT"
licenselink = "https://github.com/cubiest/hugo-invi/blob/master/LICENSE.txt"
description = "A simple, clean and lightweight Hugo theme for multilingual websites, inspired by CSS Ninja's Fresh theme"
Expand Down

0 comments on commit f47a945

Please sign in to comment.