eclipsefdn-hugo-solstice-theme 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # eclipsefdn-hugo-solstice-theme
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2e7f59d: [Params] Add support for an array of styles & scripts with ESM support in site config
8
+
3
9
  ## 3.0.1
4
10
 
5
11
  ### Patch Changes
@@ -15,8 +15,6 @@ baseURL = "https://webdev.eclipse.org/docs/hugo"
15
15
  keywords = ["hugo", "solstice", "eclipse foundation"]
16
16
  # logo = "images/logo/eclipse-foundation-white.svg"
17
17
  # favicon = "images/favicon.ico"
18
- styles = "css/neptune.css"
19
- js = "js/neptune.js"
20
18
  gcse = "011805775785170369411:p3ec0igo0qq"
21
19
  gcse_result_url = "/search"
22
20
  # eclipse_search_icon = "<i data-feather=\"search\" stroke-width=\"1\"></i>"
@@ -60,3 +58,11 @@ baseURL = "https://webdev.eclipse.org/docs/hugo"
60
58
  [blackfriday]
61
59
  plainIDAnchors = true
62
60
  hrefTargetBlank = true
61
+
62
+ [[Params.styles]]
63
+ url = "css/neptune.css"
64
+ cache = true
65
+
66
+ [[Params.scripts]]
67
+ url = "js/neptune.js"
68
+ cache = true
@@ -93,6 +93,29 @@ items:
93
93
  values:
94
94
  - "true"
95
95
  ref: /components/featured_footer/
96
+ - name: scripts
97
+ description: Array of script objects to load on the page, rendered after site-level scripts. Each entry can define a type, url, cache, defer, and integrity.
98
+ values:
99
+ - "Array of objects with the following properties: url (string, required), type (string, e.g. module), cache (boolean, appends ?v=timestamp to bust cache), defer (boolean), integrity (string)"
100
+ example: |
101
+ scripts:
102
+ - type: "module"
103
+ url: "/js/page-specific.mjs"
104
+ cache: true
105
+ - name: styles
106
+ description: Array of stylesheet objects to load on the page, rendered after site-level styles. Replaces the deprecated page_css_file param.
107
+ values:
108
+ - "Array of objects with the following properties: url (string, required), cache (boolean, appends ?v=timestamp to bust cache)"
109
+ example: |
110
+ styles:
111
+ - url: "/css/page-specific.css"
112
+ cache: true
113
+ -
114
+ name: page_css_file
115
+ deprecated: true
116
+ description: "Deprecated: use the page-level styles array instead. URL to an additional stylesheet to load on this page."
117
+ values:
118
+ - Absolute links or fully qualified URLs.
96
119
  -
97
120
  name: Summary
98
121
  description: Built in Hugo document parameter. Used in the head meta description if the Description parameter is not set.
@@ -70,7 +70,8 @@ items:
70
70
  - "true"
71
71
  -
72
72
  name: js
73
- description: URL to the main javascript to be used on the site. This does not affect any scripts added in custom sctions of the site. Defaults to <a href="https://www.eclipse.org/eclipse.org-common/themes/solstice/public/javascript/main.min.js">main.min.js</a>
73
+ deprecated: true
74
+ description: "Deprecated: use [[Params.scripts]] array instead. URL to the main javascript to be used on the site. Defaults to <a href=\"https://www.eclipse.org/eclipse.org-common/themes/solstice/public/javascript/main.min.js\">main.min.js</a>"
74
75
  values:
75
76
  - Absolute link or fully qualified URL to a JS file
76
77
  -
@@ -99,11 +100,22 @@ items:
99
100
  description: Boolean value, when set to true events will be enabled on the site.
100
101
  values:
101
102
  - "true"
102
- -
103
+ -
103
104
  name: styles
104
- description: URL to the stylesheet to be used on the site. This does not affect any stylesheets added in custom sctions of the site. Defaults to <a href="https://eclipse.org/eclipse.org-common/themes/solstice/public/stylesheets/quicksilver.min.css">quicksilver.min.css</a>
105
+ description: Array of stylesheet objects to load site-wide. Each entry supports url and cache (appends ?v=timestamp). Page-level styles are always appended after site styles. Defaults to the Neptune stylesheet.
105
106
  values:
106
- - Absolute link or fully qualified URL to a CSS file
107
+ - "Array of objects with the following properties: url (string, required), cache (boolean, appends ?v=timestamp to bust cache)"
108
+ deprecated_values:
109
+ - "Deprecated string form: a single URL string — use [[Params.styles]] array instead. The legacy style_overrides string param is also deprecated in favour of adding additional entries to this array."
110
+ example: |
111
+ <pre>
112
+ [[Params.styles]]
113
+ url = "/css/main.css"
114
+ cache = true
115
+
116
+ [[Params.styles]]
117
+ url = "/css/overrides.css"
118
+ </pre>
107
119
  -
108
120
  name: hide_breadcrumb
109
121
  description: Hides the breadcrumb on all pages if set to true, otherwise ignored.
@@ -119,6 +131,28 @@ items:
119
131
  description: Optional custom_jumbotron_class that will be used for custom_jumbotron.
120
132
  values:
121
133
  - Any string value
134
+ -
135
+ name: newsroom_esm
136
+ description: When set to true, the inline newsroom components script (events, news items) is rendered as an ES module using `import $ from "jquery"`. Defaults to false.
137
+ values:
138
+ - "true"
139
+ - "false"
140
+ - name: scripts
141
+ description: Array of script objects to load site-wide. Each entry can define a type, url, cache, defer, and integrity. When defined, this replaces the js and hugo_js params.
142
+ values:
143
+ - "Array of objects with the following properties: url (string, required), type (string, e.g. module), cache (boolean, appends ?v=timestamp to bust cache), defer (boolean), integrity (string)"
144
+ example: |
145
+ <pre>
146
+ [[Params.scripts]]
147
+ type = "module"
148
+ url = "/js/main.mjs"
149
+ cache = true
150
+
151
+ [[Params.scripts]]
152
+ defer = true
153
+ url = "https://some.cdn.com/js/script.js"
154
+ integrity = "sha384-..."
155
+ </pre>
122
156
  - name: socials
123
157
  values:
124
158
  - "Array of objects with the following properties: name (string), icon (string, Font Awesome 6 icon classes), url (string)"
@@ -1,13 +1,39 @@
1
1
  <div id="footer-js">
2
2
  <!-- Placed at the end of the document so the pages load faster -->
3
3
  {{- $default_js := "https://www.eclipse.org/public/js/neptune/main.js" -}}
4
- {{- with .Site.Params.js | default $default_js }}
5
- <script src="{{ . | relURL }}?v={{ now.Unix }}"></script>
6
- {{ end }}
4
+ {{- $site_scripts := .Site.Params.scripts -}}
5
+ {{- $page_scripts := .Page.Params.scripts -}}
7
6
 
8
- {{- with .Site.Params.hugo_js }}
7
+ {{- if $site_scripts -}}
8
+ {{- range $site_scripts -}}
9
+ {{- $src := .url | relURL -}}
10
+ {{- if .cache -}}{{- $src = printf "%s?v=%d" $src now.Unix -}}{{- end -}}
11
+ {{- $stag := printf `<script src="%s"` $src -}}
12
+ {{- with .type -}}{{- $stag = printf `%s type="%s"` $stag . -}}{{- end -}}
13
+ {{- if .defer -}}{{- $stag = printf "%s defer" $stag -}}{{- end -}}
14
+ {{- with .integrity -}}{{- $stag = printf `%s integrity="%s"` $stag . -}}{{- end -}}
15
+ {{- (printf "%s></script>" $stag) | safeHTML -}}
16
+ {{- end }}
17
+ {{- else if .Site.Params.js -}}
18
+ {{- warnf "Param 'Params.js' is deprecated. Use [[Params.scripts]] array instead. See https://webdev.eclipse.org/docs/hugo/" -}}
19
+ <script src="{{ .Site.Params.js | relURL }}?v={{ now.Unix }}"></script>
20
+ {{- with .Site.Params.hugo_js }}
21
+ {{- warnf "Param 'Params.hugo_js' is deprecated. Use [[Params.scripts]] array instead. See https://webdev.eclipse.org/docs/hugo/" -}}
9
22
  <script src="{{ . | relURL }}"></script>
10
- {{ end }}
23
+ {{- end }}
24
+ {{- else -}}
25
+ <script src="{{ $default_js | relURL }}?v={{ now.Unix }}"></script>
26
+ {{- end }}
27
+
28
+ {{- range $page_scripts -}}
29
+ {{- $src := .url | relURL -}}
30
+ {{- if .cache -}}{{- $src = printf "%s?v=%d" $src now.Unix -}}{{- end -}}
31
+ {{- $stag := printf `<script src="%s"` $src -}}
32
+ {{- with .type -}}{{- $stag = printf `%s type="%s"` $stag . -}}{{- end -}}
33
+ {{- if .defer -}}{{- $stag = printf "%s defer" $stag -}}{{- end -}}
34
+ {{- with .integrity -}}{{- $stag = printf `%s integrity="%s"` $stag . -}}{{- end -}}
35
+ {{- (printf "%s></script>" $stag) | safeHTML -}}
36
+ {{- end }}
11
37
 
12
38
  <!-- Read in mustache templates registered in page scratch -->
13
39
  {{ range $key, $value := (.Page.Scratch.Get "mustache-templates") }}
@@ -17,6 +43,21 @@
17
43
  {{ end }}
18
44
 
19
45
  <!-- Initialize any newsroom components on the page -->
46
+ {{ if (.Site.Params.newsroom_esm | default false) -}}
47
+ <script type="module">
48
+ import $ from "jquery";
49
+ {{ range (.Page.Scratch.Get "events-container-ids") }}
50
+ $("#{{ . }}").eclipseFdnApi({
51
+ type: "filteredEvents"
52
+ });
53
+ {{ end }}
54
+ {{ range (.Page.Scratch.Get "news-container-ids") }}
55
+ $("#{{ . }}").eclipseFdnApi({
56
+ type: "newsItems"
57
+ });
58
+ {{ end }}
59
+ </script>
60
+ {{- else -}}
20
61
  <script>
21
62
  (function($, document) {
22
63
  {{ range (.Page.Scratch.Get "events-container-ids") }}
@@ -31,6 +72,7 @@
31
72
  {{ end }}
32
73
  })(jQuery, document);
33
74
  </script>
75
+ {{- end }}
34
76
 
35
77
  {{ if eq (.Page.Scratch.Get "is_using_twitter") "true" }}
36
78
  <script src="https://platform.twitter.com/widgets.js" async></script>
@@ -10,9 +10,9 @@
10
10
 
11
11
  SPDX-License-Identifier: EPL-2.0
12
12
  -->
13
- <meta charset="utf-8">
14
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
15
- <meta name="viewport" content="width=device-width, initial-scale=1">
13
+ <meta charset="utf-8" />
14
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
15
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
16
16
  <!-- Site Title, Description, Author, and Favicon -->
17
17
  {{ $title := .Params.seo_title | default (.Params.headline | plainify) | default (.Title | plainify) | default .Site.Title }}
18
18
  {{ if (.Params.format_seo_title | default true) }}
@@ -25,46 +25,53 @@
25
25
  {{ $full_title := printf "%s%s" $title $title_suffix }}
26
26
  <title>{{ $full_title }}</title>
27
27
  <meta property="og:title" content="{{ $full_title }}" />
28
- <meta name="twitter:title" content="{{ $title | truncate 70 }}{{ $title_suffix }}" />
28
+ <meta
29
+ name="twitter:title"
30
+ content="{{ $title | truncate 70 }}{{ $title_suffix }}"
31
+ />
29
32
  {{ if isset .Page.Params "redirect_url" }}
30
- <link rel="canonical" href="{{ .Page.Params.redirect_url }}"/>
31
- <meta name="robots" content="noindex">
32
- <meta http-equiv="refresh" content="0; url={{ .Page.Params.redirect_url }}" />
33
+ <link rel="canonical" href="{{ .Page.Params.redirect_url }}" />
34
+ <meta name="robots" content="noindex" />
35
+ <meta http-equiv="refresh" content="0; url={{ .Page.Params.redirect_url }}" />
33
36
  {{ end }}
34
37
  {{- with .Description | default .Page.Params.summary | default .Site.Params.description | plainify }}
35
- {{- with . | replaceRE "{{[\\s\\S]*?}}" " " | truncate 160 }}
36
- <meta name="description" content="{{ . }}">
37
- <meta property="og:description" content="{{ . }}">
38
- <meta name="twitter:description" content="{{ . }}">
39
- {{- end }}
38
+ {{- $description_clean_pattern := "{{[\\s\\S]*? }}\\s*" -}}
39
+ {{- with . | replaceRE $description_clean_pattern " " | truncate 160 }}
40
+ <meta name="description" content="{{ . }}" />
41
+ <meta property="og:description" content="{{ . }}" />
42
+ <meta name="twitter:description" content="{{ . }}" />
43
+ {{- end }}
40
44
  {{- end }}
41
45
  {{- with .Page.Params.author }}
42
- <meta name="author" content="{{ . }}"/>
46
+ <meta name="author" content="{{ . }}" />
43
47
  {{- end }}
44
- {{- with .Params.page_favicon | default .Site.Params.favicon | default "https://www.eclipse.org/favicon.ico"}}
45
- <link href='{{ . | relURL }}' rel='icon' type='image/x-icon'/>
48
+ {{- with .Params.page_favicon | default .Site.Params.favicon | default "https://www.eclipse.org/favicon.ico" }}
49
+ <link href="{{ . | relURL }}" rel="icon" type="image/x-icon" />
46
50
  {{- end -}}
47
51
  {{- with .Page.Params.metatag_robots }}
48
- <meta name="robots" content="{{ . }}">
52
+ <meta name="robots" content="{{ . }}" />
49
53
  {{- end }}
50
54
  <!-- Social Media Tags -->
51
55
  {{- with .Params.share_img | default .Params.image | default .Site.Params.share_img | default .Site.Params.logo }}
52
- <meta property="og:image" content="{{ . | absURL }}" />
53
- <meta name="twitter:image" content="{{ . | absURL }}" />
56
+ <meta property="og:image" content="{{ . | absURL }}" />
57
+ <meta name="twitter:image" content="{{ . | absURL }}" />
54
58
  {{- end }}
55
59
  <meta name="twitter:card" content="summary" />
56
60
  {{- with .Site.Params.author.twitter }}
57
- <meta name="twitter:site" content="@{{ . }}" />
58
- <meta name="twitter:creator" content="@{{ . }}" />
61
+ <meta name="twitter:site" content="@{{ . }}" />
62
+ <meta name="twitter:creator" content="@{{ . }}" />
59
63
  {{- end }}
60
64
  {{- with .Site.Params.fb_app_id }}
61
- <meta property="fb:app_id" content="{{ . }}" />
65
+ <meta property="fb:app_id" content="{{ . }}" />
62
66
  {{- end }}
63
67
  <meta property="og:url" content="{{ .Permalink | absLangURL }}" />
64
68
  <meta property="og:type" content="website" />
65
69
  <meta property="og:site_name" content="{{ .Site.Title }}" />
66
70
  {{- with .Keywords | default .Site.Params.keywords }}
67
- <meta name="keywords" content="{{ range $i, $e := . }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}">
71
+ <meta
72
+ name="keywords"
73
+ content="{{ range $i, $e := . }}{{ if $i }},{{ end }}{{ $e }}{{ end }}"
74
+ />
68
75
  {{ end }}
69
76
  <!-- Hugo Version number -->
70
77
  {{ hugo.Generator -}}
@@ -72,33 +79,66 @@
72
79
  {{ $canonical_url := (.Page.Params.canonical_url | default .Permalink) | absLangURL }}
73
80
  <link rel="canonical" href="{{ $canonical_url }}" />
74
81
  {{ with .OutputFormats.Get "RSS" }}
75
- <link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="">
82
+ <link
83
+ rel="alternate"
84
+ href="{{ .RelPermalink }}"
85
+ type="application/rss+xml"
86
+ title=""
87
+ />
76
88
  {{ end }}
77
89
  {{ if ne .Page.Params.disable_css "true" }}
78
- {{- $default_css := "https://www.eclipse.org/public/css/neptune.css" -}}
79
- {{- with .Site.Params.styles | default $default_css }}
80
- <link rel="stylesheet" href="{{ . | relURL }}?v={{ now.Unix }}">
81
- {{- end }}
82
- {{- with .Site.Params.style_overrides }}
83
- <link rel="stylesheet" href="{{ . | relURL }}?v={{ now.Unix }}">
84
- {{- end }}
85
- {{- with .Page.Params.page_css_file }}
86
- <link rel="stylesheet" href="{{ . | relURL }}?v={{ now.Unix }}">
87
- {{- end }}
90
+ {{- $default_css := "https://www.eclipse.org/public/css/neptune.css" -}}
91
+ {{- $site_styles := .Site.Params.styles -}}
92
+ {{- $page_styles := .Page.Params.styles -}}
93
+
94
+ {{- if $site_styles -}}
95
+ {{- range $site_styles -}}
96
+ {{- $href := .url | relURL -}}
97
+ {{- if .cache -}}
98
+ {{- $href = printf "%s?v=%d" $href now.Unix -}}
99
+ {{- end -}}
100
+ <link rel="stylesheet" href="{{ $href }}" />
101
+ {{- end }}
102
+ {{- else if .Site.Params.styles -}}
103
+ {{- warnf "Param 'Params.styles' is deprecated. Use [[Params.styles]] array instead. See https://webdev.eclipse.org/docs/hugo/" -}}
104
+ <link rel="stylesheet" href="{{ .Site.Params.styles | relURL }}?v={{ now.Unix }}" />
105
+ {{- with .Site.Params.style_overrides }}
106
+ {{- warnf "Param 'Params.style_overrides' is deprecated. Use [[Params.styles]] array instead. See https://webdev.eclipse.org/docs/hugo/" -}}
107
+ <link rel="stylesheet" href="{{ . | relURL }}?v={{ now.Unix }}" />
108
+ {{- end }}
109
+ {{- else -}}
110
+ <link
111
+ rel="stylesheet"
112
+ href="{{ $default_css | relURL }}?v={{ now.Unix }}"
113
+ />
114
+ {{- end }}
115
+
116
+ {{- range $page_styles -}}
117
+ {{- $href := .url | relURL -}}
118
+ {{- if .cache -}}{{- $href = printf "%s?v=%d" $href now.Unix -}}{{- end -}}
119
+ <link rel="stylesheet" href="{{ $href }}" />
120
+ {{- end }}
121
+
122
+ {{- if not $page_styles -}}
123
+ {{- with .Page.Params.page_css_file }}
124
+ {{- warnf "Page param 'page_css_file' is deprecated. Use the page-level styles array instead. See https://webdev.eclipse.org/docs/hugo/" -}}
125
+ <link rel="stylesheet" href="{{ . | relURL }}?v={{ now.Unix }}" />
126
+ {{- end }}
127
+ {{- end }}
88
128
  {{- end }}
89
129
  {{- partial "google_tag_manager.html" . }}
90
130
  {{- partial "head_variables.html" . }}
91
131
 
92
132
  {{ $metadata := .Page.Params.metadata | default slice }}
93
133
  {{ range $metadata }}
94
- {{ $path_parts := split .path "/" }}
95
- {{ $data := $.Site.Data }}
96
- {{ range $path_parts }}
134
+ {{ $path_parts := split .path "/" }}
135
+ {{ $data := $.Site.Data }}
136
+ {{ range $path_parts }}
97
137
  {{ $data = index $data . }}
98
138
  {{ end }}
99
139
  {{ if eq .type "ld+json" }}
100
140
  <script type="application/ld+json">
101
- {{ with $data }}
141
+ {{ with $data }}
102
142
  {{ . }}
103
143
  {{ end }}
104
144
  </script>
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "webpack.min.js",
5
5
  "author": "Christopher Guindon",
6
6
  "license": "EPL-2.0",
7
- "version": "3.0.1",
7
+ "version": "3.1.0",
8
8
  "bugs": {
9
9
  "url": "https://gitlab.eclipse.org/eclipsefdn/it/webdev/hugo-solstice-theme/-/issues"
10
10
  },