summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-04-27 20:45:12 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2018-04-27 20:45:12 +0200
commit74087a15b63dbc062e1c8a785917f44cda5f14c7 (patch)
treebd20677420b33aae27bb3ba6065c1757880caecf
parente372ee22511a0e084b7957316909705bf9628d01 (diff)
downloadwww-andreasbaumann-cc-74087a15b63dbc062e1c8a785917f44cda5f14c7.tar.gz
www-andreasbaumann-cc-74087a15b63dbc062e1c8a785917f44cda5f14c7.tar.bz2
better GDPR page
-rw-r--r--config.toml3
-rw-r--r--content/dataprotection/_index.md4
-rw-r--r--search/elasticlunr/README24
-rwxr-xr-xsearch/elasticlunr/create_xml.sh (renamed from strus/create_xml.sh)4
-rw-r--r--search/strus/README (renamed from strus/README)0
-rwxr-xr-xsearch/strus/create_xml.sh58
-rw-r--r--search/strus/document.ana (renamed from strus/document.ana)0
-rw-r--r--themes/new_theme/layouts/partials/comments-disqus.html31
-rw-r--r--themes/new_theme/layouts/partials/footer.html2
-rw-r--r--themes/new_theme/layouts/partials/menu.html4
-rw-r--r--themes/new_theme/layouts/partials/widgets/elasticlunr_search.html24
11 files changed, 114 insertions, 40 deletions
diff --git a/config.toml b/config.toml
index 7dc611c..1fae1e9 100644
--- a/config.toml
+++ b/config.toml
@@ -15,9 +15,6 @@ SectionPagesMenu = "main"
copyright_years = "2009 - 2018"
opengraph = true
strus_url = "http://eeepc.home:8080/strus/query/wwwandreasbaumanncc"
- DisqusUrl = "http://www.andreasbaumann.cc"
- DisqusShortname = "wwwandreasbaumanncc"
- disable_comments = true
[Params.widgets]
search = true
diff --git a/content/dataprotection/_index.md b/content/dataprotection/_index.md
index 1095b48..f407ccf 100644
--- a/content/dataprotection/_index.md
+++ b/content/dataprotection/_index.md
@@ -1,5 +1,5 @@
+++
-title = "Data Protection"
+title = "Data Protection And Privacy"
+++
This website uses a static HTML generator, so no cookies are used.
@@ -9,7 +9,7 @@ I don't use any social media buttons like Facebook likes.
I don't track the web pages with any tool like Google Analytics
or Piwik.
-I do keep Apache log entires and firewall rules with IPs and User-Agent
+I do keep Apache log entries and firewall rules with IP, Date and User-Agent
information for at most 7 days in order to fight attacks and spam.
I do use a Google search currently, but you have the option to just
diff --git a/search/elasticlunr/README b/search/elasticlunr/README
new file mode 100644
index 0000000..c1c318c
--- /dev/null
+++ b/search/elasticlunr/README
@@ -0,0 +1,24 @@
+# Search index with elasticlunr
+
+# Create a search index which can be served statically along the
+# static HTML pages to staticlunr.js.
+
+# YAML/TOML/JSON and Markdown:
+# remarshal (https://github.com/dbohdan/remarshal)
+# pandoc (http://pandoc.org/)
+
+# create XML and clean up some problematic constructs
+./create_xml.sh > posts.xml
+sed -i 's/xlink:href/href/g' posts.xml
+sed -i 's/ xml:id="[^"]\+"//g' posts.xml
+xmllint -noout posts.xml
+
+# convert XML to JSON (at least the relevant fields for the index)
+
+# use posts.json in a | node create_index.js pipeline
+# -> results in posts_index.json
+
+# add as static contents to hugo site
+
+# load from JS search code on demand (first query) if possible,
+# if small, do it immediatelly when loading the search widget.
diff --git a/strus/create_xml.sh b/search/elasticlunr/create_xml.sh
index 4ef5c5a..50ce4b3 100755
--- a/strus/create_xml.sh
+++ b/search/elasticlunr/create_xml.sh
@@ -11,9 +11,9 @@ else
SED=sed
fi
-for file in `find ../content/ -name '*.md'`; do
+for file in `find ../../content/ -name '*.md'`; do
echo "$file.." 1>&2
- slug=`echo $file | $SED 's@../content@@g' | $SED 's@/_index.md$@@g' | $SED 's@.md$@@g'`
+ slug=`echo $file | $SED 's@../../content@@g' | $SED 's@/_index.md$@@g' | $SED 's@.md$@@g'`
if test "x$slug" = "x"; then
slug="/"
fi
diff --git a/strus/README b/search/strus/README
index 4f2ad15..4f2ad15 100644
--- a/strus/README
+++ b/search/strus/README
diff --git a/search/strus/create_xml.sh b/search/strus/create_xml.sh
new file mode 100755
index 0000000..50ce4b3
--- /dev/null
+++ b/search/strus/create_xml.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+cat <<EOF
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<posts>
+EOF
+
+if test `uname -s` = 'Darwin'; then
+ SED=gsed
+else
+ SED=sed
+fi
+
+for file in `find ../../content/ -name '*.md'`; do
+ echo "$file.." 1>&2
+ slug=`echo $file | $SED 's@../../content@@g' | $SED 's@/_index.md$@@g' | $SED 's@.md$@@g'`
+ if test "x$slug" = "x"; then
+ slug="/"
+ fi
+
+ slug=`echo $slug | sed 's@^//@/@g'`
+
+ awk 'BEGIN { i = 0 } /\+\+\+/{x="F"++i;}{print > x;}' $file >/dev/null 2>&1
+
+ if test ! -f F1 -a -f F2; then
+ continue
+ fi
+
+ tail -n +2 F1 > meta.toml
+ tail -n +3 F2 > body.md
+
+ $SED -i 's/\&/&amp;/g' meta.toml
+ $SED -i 's/</\&lt;/g' meta.toml
+ $SED -i 's/>/\&gt;/g' meta.toml
+ $SED -i 's/\&/&amp;/g' body.md
+ $SED -i 's/</\&lt;/g' body.md
+ $SED -i 's/>/\&gt;/g' body.md
+
+ remarshal -if toml -of json meta.toml > meta.json
+ pandoc -f markdown -t docbook body.md > body.xml
+
+ echo "<post>"
+ echo "<slug>$slug</slug>"
+ echo "<filename>$file</filename>"
+ echo "<meta>"
+ cat meta.json
+ echo "</meta>"
+ echo "<body>"
+ cat body.xml
+ echo "</body>"
+ echo "</post>"
+
+ rm -f meta.* body.* F1 F2
+done
+
+cat <<EOF
+</posts>
+EOF
diff --git a/strus/document.ana b/search/strus/document.ana
index 8fbcf3e..8fbcf3e 100644
--- a/strus/document.ana
+++ b/search/strus/document.ana
diff --git a/themes/new_theme/layouts/partials/comments-disqus.html b/themes/new_theme/layouts/partials/comments-disqus.html
deleted file mode 100644
index 7af75f0..0000000
--- a/themes/new_theme/layouts/partials/comments-disqus.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{{ if (not .Params.disable_comments) }}
-<div id="disqus_thread"></div>
-
-<script src="/js/jquery.js" type="text/javascript"></script>
-
-<script type="text/javascript">
-
-var disqus_config = function () {
- this.page.url = '{{ .Permalink }}';
- this.page.identifier = '{{ .Site.Params.DisqusShortname }}_{{ .UniqueID }}';
-};
-
-(function() {
- // Don't ever inject Disqus on localhost--it creates unwanted
- // discussions from 'localhost:1313' on your Disqus account...
- if (window.location.hostname == "localhost")
- return;
-
- var d = document, s = d.createElement('script');
-
- s.src = 'https://wwwandreasbaumanncc.disqus.com/embed.js';
-
- s.setAttribute('data-timestamp', +new Date());
- (d.head || d.body).appendChild(s);
-
-alert( disqus_config );
-})();
-</script>
-<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
-<a href="http://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
-{{ end }}
diff --git a/themes/new_theme/layouts/partials/footer.html b/themes/new_theme/layouts/partials/footer.html
index 3513e6c..d7fce85 100644
--- a/themes/new_theme/layouts/partials/footer.html
+++ b/themes/new_theme/layouts/partials/footer.html
@@ -1,7 +1,7 @@
</div>
<footer class="footer" itemscope="itemscope" itemtype="http://schema.org/WPFooter">
<div class="container container-inner">
- <p class="footer__copyright">&copy; {{ .Site.Params.copyright_years }}, {{ .Site.Params.Location }}, {{ .Site.Params.author }}. Based on <a href="//wordpress.org/themes/mh-magazine-lite/" target="_blank" rel="nofollow noopener noreferrer">MH Magazine lite</a>.</p>
+ <p class="footer__copyright">&copy; {{ .Site.Params.copyright_years }}, {{ .Site.Params.Location }}, {{ .Site.Params.author }}. Based on <a href="//wordpress.org/themes/mh-magazine-lite/" target="_blank" rel="nofollow noopener noreferrer">MH Magazine lite</a>, read here about <a href="/dataprotection">Data Protection and Privacy</a></p>
</div>
</footer>
</div><!-- .mh-container-outer -->
diff --git a/themes/new_theme/layouts/partials/menu.html b/themes/new_theme/layouts/partials/menu.html
index 3a8fae2..fbeb352 100644
--- a/themes/new_theme/layouts/partials/menu.html
+++ b/themes/new_theme/layouts/partials/menu.html
@@ -3,7 +3,9 @@
{{- if .Site.Menus.main }}
{{- $currentNode := . }}
{{- range sort .Site.Menus.main }}
- <li class="menu__item {{if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }}menu__item--active{{end}}"><a class="menu__link" href="{{ .URL }}">{{ .Name | upper }}</a></li>
+ {{ if ( not ( eq .Name "Data Protection And Privacy" ) ) }}
+ <li class="menu__item {{if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }}menu__item--active{{end}}"><a class="menu__link" href="{{ .URL }}">{{ .Name | upper }}</a></li>
+ {{- end }}
{{- end }}
{{- end }}
</ul>
diff --git a/themes/new_theme/layouts/partials/widgets/elasticlunr_search.html b/themes/new_theme/layouts/partials/widgets/elasticlunr_search.html
new file mode 100644
index 0000000..544be8d
--- /dev/null
+++ b/themes/new_theme/layouts/partials/widgets/elasticlunr_search.html
@@ -0,0 +1,24 @@
+{{- if .Site.Params.widgets.search }}
+ElasticLunr:
+<div class="widget-search widget">
+ <form class="widget-search__form" role="search" method="get" action="/search/">
+ <label>
+ <span class="screen-reader-text">Search for:</span>
+ <input class="widget-search__field" type="search" autocomplete="off" placeholder="SEARCH..." value="" id="query" name="q">
+ </label>
+ <input class="widget-search__submit" type="submit" value="Search">
+ </form>
+</div>
+<script language="Javascript">
+ $( window ).load( function( ) {
+ var paramsString = window.location.search;
+ var searchParams = new URLSearchParams( paramsString );
+ if( searchParams.has( "q" ) ) {
+ $( "#query" ).val( searchParams.get( "q" ) );
+ $( "#query" ).removeAttr( "placeholder" );
+ }
+ } );
+</script>
+{{- end }}
+
+