diff --git a/layouts/partials/data/functions/wikidata-label.html b/layouts/partials/data/functions/wikidata-label.html deleted file mode 100644 index 32ee8b1fee..0000000000 --- a/layouts/partials/data/functions/wikidata-label.html +++ /dev/null @@ -1,57 +0,0 @@ -{{- $entityBase := "http://www.wikidata.org/entity/" -}} -{{- $defaultLangs := slice "en" "de" -}} - -{{- $debug := partialCached "partials/functions/debug/enabled.html" . -}} - -{{- $url := .url -}} -{{- with .langs -}} - {{- $defaultLangs = . -}} - {{- if $debug -}} - {{- warnf "[data/functions/wikidata-label.html] Setting languages to %s for %s" $defaultLangs $url -}} - {{- end -}} -{{- end -}} - -{{- $uri := "" -}} -{{- $id := "" -}} -{{- if hasPrefix $url "http://www.wikidata.org/entity/" -}} - {{- $id = replaceRE `http://www.wikidata.org/entity/` "" $url -}} - {{- $uri = $url -}} -{{- else if hasPrefix "" "https" -}} - {{- $id = replaceRE `https://www.wikidata.org/wiki/` "" $url -}} - {{- $uri = printf "%s%s" $entityBase $id -}} -{{- else -}} - {{- $id = $url -}} - {{- $uri = printf "%s%s" $entityBase $id -}} -{{- end -}} - -{{- $data := dict -}} -{{- $jsonURL := printf "%s%s" (replace $uri "http://" "https://") ".json" -}} - -{{- if $debug -}} - {{- warnf "[data/functions/wikidata-label.html] Getting label for %s from %s" $id $jsonURL -}} -{{- end -}} - -{{- with resources.GetRemote $jsonURL (dict "headers" (dict "Accept" "application/json")) -}} - {{- with .Err -}} - {{ errorf "%s" . -}} - {{- else -}} - {{ $data = .Content | transform.Unmarshal -}} - {{- end -}} -{{- else -}} - {{ errorf "Unable to get remote resource %q" $jsonURL }} -{{- end -}} - -{{- $entity := index $data.entities $id -}} - -{{- $label := "" -}} -{{- range $defaultLangs -}} - {{- if and (isset $entity.labels .) (eq $label "") -}} - {{- $label = (index $entity.labels .).value -}} - {{- end -}} -{{ end }} - -{{- if eq $label "" -}} - {{- $label = $id -}} -{{- end -}} - -{{- return $label -}} diff --git a/layouts/partials/data/schema.org.html b/layouts/partials/data/schema.org.html deleted file mode 100644 index b799901a5e..0000000000 --- a/layouts/partials/data/schema.org.html +++ /dev/null @@ -1,12 +0,0 @@ -{{- $debug := partialCached "partials/functions/debug/enabled.html" . -}} - -{{- if and .IsHome (templates.Exists "partials/schema.org/home.html") -}} - {{- partial "schema.org/home.html" . -}} -{{- else -}} - {{- $schemaTemplate := printf "schema.org/%s.html" .Kind -}} - {{- if templates.Exists (printf "partials/%s" $schemaTemplate) -}} - {{- partial $schemaTemplate . -}} - {{- else if $debug -}} - {{- warnf "[data/schema.org.html] Can't find %s" $schemaTemplate -}} - {{- end -}} -{{- end -}} diff --git a/layouts/partials/data/wikidata.html b/layouts/partials/data/wikidata.html deleted file mode 100644 index 47df120607..0000000000 --- a/layouts/partials/data/wikidata.html +++ /dev/null @@ -1,38 +0,0 @@ -{{- $defaultRelation := "related" -}} -{{- $entityBase := "http://www.wikidata.org/entity/" -}} - -{{- with .Params.wikidata -}} - - {{- $primaryLang := $.Language.Lang -}} - {{- $langs := slice $primaryLang -}} - {{- range $.Translations -}} - {{- $langs = $langs | append .Language.Lang -}} - {{- end -}} - - {{- $entries := dict -}} - {{- if not (reflect.IsMap .) -}} - {{- $list := slice -}} - {{- if not (reflect.IsSlice .) -}} - {{- $list = slice . -}} - {{- else -}} - {{- $list = . -}} - {{- end -}} - {{- range $list -}} - {{- $entries = merge $entries (dict . $defaultRelation) -}} - {{- end -}} - {{- else -}} - {{- $entries = . -}} - {{- end -}} - -