From 74087a15b63dbc062e1c8a785917f44cda5f14c7 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 27 Apr 2018 20:45:12 +0200 Subject: better GDPR page --- config.toml | 3 -- content/dataprotection/_index.md | 4 +- search/elasticlunr/README | 24 +++++++++ search/elasticlunr/create_xml.sh | 58 ++++++++++++++++++++++ search/strus/README | 26 ++++++++++ search/strus/create_xml.sh | 58 ++++++++++++++++++++++ search/strus/document.ana | 27 ++++++++++ strus/README | 26 ---------- strus/create_xml.sh | 58 ---------------------- strus/document.ana | 27 ---------- .../layouts/partials/comments-disqus.html | 31 ------------ themes/new_theme/layouts/partials/footer.html | 2 +- themes/new_theme/layouts/partials/menu.html | 4 +- .../partials/widgets/elasticlunr_search.html | 24 +++++++++ 14 files changed, 223 insertions(+), 149 deletions(-) create mode 100644 search/elasticlunr/README create mode 100755 search/elasticlunr/create_xml.sh create mode 100644 search/strus/README create mode 100755 search/strus/create_xml.sh create mode 100644 search/strus/document.ana delete mode 100644 strus/README delete mode 100755 strus/create_xml.sh delete mode 100644 strus/document.ana delete mode 100644 themes/new_theme/layouts/partials/comments-disqus.html create mode 100644 themes/new_theme/layouts/partials/widgets/elasticlunr_search.html 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/search/elasticlunr/create_xml.sh b/search/elasticlunr/create_xml.sh new file mode 100755 index 0000000..50ce4b3 --- /dev/null +++ b/search/elasticlunr/create_xml.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +cat < + +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/\&/&/g' meta.toml + $SED -i 's//\>/g' meta.toml + $SED -i 's/\&/&/g' body.md + $SED -i 's//\>/g' body.md + + remarshal -if toml -of json meta.toml > meta.json + pandoc -f markdown -t docbook body.md > body.xml + + echo "" + echo "$slug" + echo "$file" + echo "" + cat meta.json + echo "" + echo "" + cat body.xml + echo "" + echo "" + + rm -f meta.* body.* F1 F2 +done + +cat < +EOF diff --git a/search/strus/README b/search/strus/README new file mode 100644 index 0000000..4f2ad15 --- /dev/null +++ b/search/strus/README @@ -0,0 +1,26 @@ +# Search index with strus + +# For now create an XML from the content, later have a directory iterator +# over 'content' and read TOML/YAML headers and markdown... + +# TODO: this becomes obsolete with a Hugo segmenter which undestands +# YAML/TOML/JSON and Markdown: +# remarshal (https://github.com/dbohdan/remarshal) +# pandoc (http://pandoc.org/) +# client-side needs: +# https://github.com/fortnightlabs/snowball-js + +./create_xml.sh > posts.xml + +xmllint -noout posts.xml + +# test configuration of document analysis + +strusAnalyze document.ana posts.xml |& less + +# Create the strus search index: + +rm -rf storage +mkdir storage +strusCreate -s 'path=storage/wwwandreasbaumanncc; metadata=doclen UINT16, publish_date UINT16' +strusInsert -c 1000 -f 1 -t 1 -s "path=storage/wwwandreasbaumanncc" document.ana posts.xml 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 + +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/\&/&/g' meta.toml + $SED -i 's//\>/g' meta.toml + $SED -i 's/\&/&/g' body.md + $SED -i 's//\>/g' body.md + + remarshal -if toml -of json meta.toml > meta.json + pandoc -f markdown -t docbook body.md > body.xml + + echo "" + echo "$slug" + echo "$file" + echo "" + cat meta.json + echo "" + echo "" + cat body.xml + echo "" + echo "" + + rm -f meta.* body.* F1 F2 +done + +cat < +EOF diff --git a/search/strus/document.ana b/search/strus/document.ana new file mode 100644 index 0000000..8fbcf3e --- /dev/null +++ b/search/strus/document.ana @@ -0,0 +1,27 @@ +[Document] + post = /posts/post; + +[Content] + "encoding=UTF-8; content=JSON;" /posts/post/meta(); + +[Attribute] + docid = orig content /posts/post/slug(); + title = orig content /posts/post/meta()/title(); + categories = orig content /posts/post/meta()/categories(); + thumbnail = orig content /posts/post/meta()/thumbnail(); + +[SearchIndex] + word = lc:convdia(en):stem(en):lc regex("([A-Za-z']+)") /posts/post/meta()/title(); + word = lc:convdia(en):stem(en):lc regex("([A-Za-z']+)") /posts/post/body//para(); + sentence = empty punctuation("en") /posts/post/body//para(); + +[ForwardIndex] + title = orig split /posts/post/meta()/title(); + text = orig split /posts/post/body//para(); + +#[MetaData] +# release_date = date2int("d 1877-01-01", "%Y-%m-%d %H:%M:%s *") content /posts/post/meta()/date; + +[Aggregator] + doclen = count( word ); + diff --git a/strus/README b/strus/README deleted file mode 100644 index 4f2ad15..0000000 --- a/strus/README +++ /dev/null @@ -1,26 +0,0 @@ -# Search index with strus - -# For now create an XML from the content, later have a directory iterator -# over 'content' and read TOML/YAML headers and markdown... - -# TODO: this becomes obsolete with a Hugo segmenter which undestands -# YAML/TOML/JSON and Markdown: -# remarshal (https://github.com/dbohdan/remarshal) -# pandoc (http://pandoc.org/) -# client-side needs: -# https://github.com/fortnightlabs/snowball-js - -./create_xml.sh > posts.xml - -xmllint -noout posts.xml - -# test configuration of document analysis - -strusAnalyze document.ana posts.xml |& less - -# Create the strus search index: - -rm -rf storage -mkdir storage -strusCreate -s 'path=storage/wwwandreasbaumanncc; metadata=doclen UINT16, publish_date UINT16' -strusInsert -c 1000 -f 1 -t 1 -s "path=storage/wwwandreasbaumanncc" document.ana posts.xml diff --git a/strus/create_xml.sh b/strus/create_xml.sh deleted file mode 100755 index 4ef5c5a..0000000 --- a/strus/create_xml.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -cat < - -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/\&/&/g' meta.toml - $SED -i 's//\>/g' meta.toml - $SED -i 's/\&/&/g' body.md - $SED -i 's//\>/g' body.md - - remarshal -if toml -of json meta.toml > meta.json - pandoc -f markdown -t docbook body.md > body.xml - - echo "" - echo "$slug" - echo "$file" - echo "" - cat meta.json - echo "" - echo "" - cat body.xml - echo "" - echo "" - - rm -f meta.* body.* F1 F2 -done - -cat < -EOF diff --git a/strus/document.ana b/strus/document.ana deleted file mode 100644 index 8fbcf3e..0000000 --- a/strus/document.ana +++ /dev/null @@ -1,27 +0,0 @@ -[Document] - post = /posts/post; - -[Content] - "encoding=UTF-8; content=JSON;" /posts/post/meta(); - -[Attribute] - docid = orig content /posts/post/slug(); - title = orig content /posts/post/meta()/title(); - categories = orig content /posts/post/meta()/categories(); - thumbnail = orig content /posts/post/meta()/thumbnail(); - -[SearchIndex] - word = lc:convdia(en):stem(en):lc regex("([A-Za-z']+)") /posts/post/meta()/title(); - word = lc:convdia(en):stem(en):lc regex("([A-Za-z']+)") /posts/post/body//para(); - sentence = empty punctuation("en") /posts/post/body//para(); - -[ForwardIndex] - title = orig split /posts/post/meta()/title(); - text = orig split /posts/post/body//para(); - -#[MetaData] -# release_date = date2int("d 1877-01-01", "%Y-%m-%d %H:%M:%s *") content /posts/post/meta()/date; - -[Aggregator] - doclen = count( word ); - 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) }} -
- - - - - -comments powered by Disqus -{{ 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 @@ 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 }} - + {{ if ( not ( eq .Name "Data Protection And Privacy" ) ) }} + + {{- end }} {{- end }} {{- end }} 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: + + +{{- end }} + + -- cgit v1.2.3-54-g00ecf