Skip to content

Commit 0727528

Browse files
authored
Adopt site to comply w/ ASF data privacy policy (apache#709)
1 parent c08e8d1 commit 0727528

File tree

3 files changed

+134
-4
lines changed

3 files changed

+134
-4
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*!
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
/* Disable (external) Google Fonts, according to the ASF data policy,
21+
see https://privacy.apache.org/policies/website-policy.html &
22+
https://www.docsy.dev/docs/adding-content/lookandfeel/#fonts
23+
*/
24+
$td-enable-google-fonts: false;

site/hugo.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ permalinks:
2828

2929
params:
3030
author.name: 'Apache Polaris contributors'
31-
offlineSearch: true
31+
3232
github_repo: https://github.com/apache/polaris
3333
github_project_repo: https://github.com/apache/polaris
3434
github_branch: main
3535
github_subdir: site
3636
privacy_policy: https://privacy.apache.org/policies/privacy-policy-public.html
3737

38+
# Offline search from Docsy theme, uses "Lunr", see https://www.docsy.dev/docs/adding-content/search/#local-search-with-lunr
39+
# The file layouts/partials/head.html has been adopted to embed the JS
40+
offlineSearch: true
41+
3842
links:
3943
# End user relevant links. These will show up on left side of footer and in the community page if you have one.
4044
user:
@@ -78,9 +82,13 @@ params:
7882
sidebar_search_disable: true
7983

8084
plantuml:
81-
enable: true
85+
# Disabled for now, loads external JS, see ASF data policy
86+
# https://privacy.apache.org/policies/website-policy.html
87+
enable: false
8288
markmap:
83-
enable: true
89+
# Disabled for now, loads external JS, see ASF data policy
90+
# https://privacy.apache.org/policies/website-policy.html
91+
enable: false
8492

8593
imaging:
8694
resampleFilter: "CatmullRom"
@@ -232,7 +240,7 @@ security:
232240

233241
privacy:
234242
googleAnalytics:
235-
respectDoNotTrack: true
243+
disable: true
236244
instagram:
237245
simple: true
238246
twitter:

site/layouts/partials/head.html

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!--
2+
~ Licensed to the Apache Software Foundation (ASF) under one
3+
~ or more contributor license agreements. See the NOTICE file
4+
~ distributed with this work for additional information
5+
~ regarding copyright ownership. The ASF licenses this file
6+
~ to you under the Apache License, Version 2.0 (the
7+
~ "License"); you may not use this file except in compliance
8+
~ with the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing,
13+
~ software distributed under the License is distributed on an
14+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
~ KIND, either express or implied. See the License for the
16+
~ specific language governing permissions and limitations
17+
~ under the License.
18+
-->
19+
<meta charset="utf-8">
20+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
21+
{{ range .AlternativeOutputFormats -}}
22+
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
23+
{{ end -}}
24+
25+
{{ $outputFormat := partial "outputformat.html" . -}}
26+
{{ if and hugo.IsProduction (ne $outputFormat "print") -}}
27+
<meta name="robots" content="index, follow">
28+
{{ else -}}
29+
<meta name="robots" content="noindex, nofollow">
30+
{{ end -}}
31+
32+
{{ partialCached "favicons.html" . }}
33+
<title>
34+
{{- if .IsHome -}}
35+
{{ .Site.Title -}}
36+
{{ else -}}
37+
{{ with .Title }}{{ . }} | {{ end -}}
38+
{{ .Site.Title -}}
39+
{{ end -}}
40+
</title>
41+
<meta name="description" content="{{ template "partials/page-description.html" . }}">
42+
{{ template "_internal/opengraph.html" . -}}
43+
{{ template "_internal/schema.html" . -}}
44+
{{ template "_internal/twitter_cards.html" . -}}
45+
{{ partialCached "head-css.html" . "asdf" -}}
46+
47+
<!--
48+
Customization to host jQuery + Lunr JS files on ASF site
49+
-->
50+
{{ $jqueryUrl := "https://code.jquery.com/jquery-3.7.1.min.js" -}}
51+
{{ with resources.GetRemote $jqueryUrl }}
52+
<script
53+
src="{{ .RelPermalink }}"
54+
integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g=="
55+
crossorigin="anonymous"></script>
56+
{{ end -}}
57+
{{ if .Site.Params.offlineSearch -}}
58+
{{ $lunrUrl := "https://unpkg.com/[email protected]/lunr.min.js" -}}
59+
{{ with resources.GetRemote $lunrUrl }}
60+
<script defer
61+
src="{{ .RelPermalink }}"
62+
integrity="sha384-203J0SNzyqHby3iU6hzvzltrWi/M41wOP5Gu+BiJMz5nwKykbkUx8Kp7iti0Lpli"
63+
crossorigin="anonymous"></script>
64+
{{ end -}}
65+
{{ end -}}
66+
67+
{{ if .Site.Params.prism_syntax_highlighting -}}
68+
<link rel="stylesheet" href="{{ "css/prism.css" | relURL }}"/>
69+
{{ end -}}
70+
71+
{{ template "algolia/head" . -}}
72+
73+
{{ partial "hooks/head-end.html" . -}}
74+
75+
{{/* To comply with GDPR, cookie consent scripts places in head-end must execute before Google Analytics is enabled */ -}}
76+
{{ if hugo.IsProduction -}}
77+
{{ $enableGtagForUniversalAnalytics := not .Site.Params.disableGtagForUniversalAnalytics -}}
78+
{{ if (or $enableGtagForUniversalAnalytics (hasPrefix .Site.Config.Services.GoogleAnalytics.ID "G-")) -}}
79+
{{ template "_internal/google_analytics_gtag.html" . -}}
80+
{{ else -}}
81+
{{ template "_internal/google_analytics.html" . -}}
82+
{{ end -}}
83+
{{ end -}}
84+
85+
{{ define "algolia/head" -}}
86+
87+
{{ if and .Site.Params.search (isset .Site.Params.search "algolia") -}}
88+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/[email protected]"
89+
integrity="sha512-AyDFDkYyALC5qoao077IqAOV7UC4oKCBTp+mJfjIt306AIRoBxoEZYDo0kAx/R7RbT+3EYEky1po/F1w1eQt7g=="
90+
crossorigin="anonymous" />
91+
{{ end -}}
92+
93+
{{ if ne .Site.Params.algolia_docsearch nil -}}
94+
{{ warnf `Config 'params.algolia_docsearch' is deprecated: use 'params.search.algolia'
95+
For details, see https://www.docsy.dev/docs/adding-content/search/#algolia-docsearch.` -}}
96+
{{ end -}}
97+
98+
{{ end -}}

0 commit comments

Comments
 (0)