summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2016-08-21 18:47:04 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2016-08-21 18:47:04 +0200
commit1d13524bf623469daeb5c4f26bbb8269213ad710 (patch)
tree963495fd9e023d68a91cfed2ff7170fb0b52fca0
parent1f824e6ae5ac39d0cefe0244ea9223c1783494f3 (diff)
downloadpragblog-1d13524bf623469daeb5c4f26bbb8269213ad710.tar.gz
pragblog-1d13524bf623469daeb5c4f26bbb8269213ad710.zip
add shortcodes: map, rating
-rw-r--r--content/karte/kartehier.md10
-rw-r--r--content/rating/ratemal.md14
-rw-r--r--layouts/shortcodes/map.html50
-rw-r--r--layouts/shortcodes/rate.html13
-rw-r--r--themes/flog/layouts/partials/header.html1
5 files changed, 88 insertions, 0 deletions
diff --git a/content/karte/kartehier.md b/content/karte/kartehier.md
new file mode 100644
index 0000000..72c8d0c
--- /dev/null
+++ b/content/karte/kartehier.md
@@ -0,0 +1,10 @@
+---
+categories:
+date: 2016-07-27
+title: Eine Karte
+---
+
+Ich esse gerne hier.
+
+<!--more-->
+{{< map zoom="15" lat="51.881111" lon="10.562222" >}}
diff --git a/content/rating/ratemal.md b/content/rating/ratemal.md
new file mode 100644
index 0000000..d8c9156
--- /dev/null
+++ b/content/rating/ratemal.md
@@ -0,0 +1,14 @@
+---
+categories:
+date: 2016-07-26
+title: Rate Me
+---
+
+Eine Bewertung.
+<!--more-->
+
+Geiles Essen, {{< rate 5 >}}
+
+Optik Scheiße, {{< rate 0 >}}.
+
+Mittelding ist {{< rate 2 halb >}}.
diff --git a/layouts/shortcodes/map.html b/layouts/shortcodes/map.html
new file mode 100644
index 0000000..0ee7d3c
--- /dev/null
+++ b/layouts/shortcodes/map.html
@@ -0,0 +1,50 @@
+<div class="section">
+ <div id="map" style="width: 100%; height: 40em;"></div>
+ <script>
+ document.addEventListener("DOMContentLoaded", function() {
+ $('<link>').appendTo('head')
+ .attr({type: 'text/css', rel: 'stylesheet'})
+ .attr('href', 'https://api.mapbox.com/mapbox-gl-js/v0.22.1/mapbox-gl.css');
+ $.getScript('https://api.mapbox.com/mapbox-gl-js/v0.22.1/mapbox-gl.js', function() {
+ mapboxgl.accessToken = 'pk.eyJ1IjoiY29kZS13dnMiLCJhIjoiY2lzNHM4bWUwMDAwdTJ0cDBjYms5em9hYSJ9.VLxxJ6aTbWUbQchg58tgkA';
+ var lon = parseFloat({{ .Get "lon" }}),
+ lat = parseFloat({{ .Get "lat" }});
+ var map = new mapboxgl.Map({
+ pitch: 60,
+ bearing: 45,
+ container: 'map',
+ style: 'mapbox://styles/mapbox/basic-v9',
+ zoom: {{ .Get "zoom" }},
+ center: [lon, lat]
+ });
+ map.on('load', function() {
+ var markers = {
+ "type": "FeatureCollection",
+ "features": [{
+ "type": "Feature",
+ "properties": {
+ "icon": "fast-food"
+ },
+ "geometry": {
+ "type": "Point",
+ "coordinates": [lon, lat]
+ }
+ }]
+ };
+ map.addSource("markers", {
+ "type": "geojson",
+ "data": markers
+ });
+ map.addLayer({
+ "id": "markers",
+ "type": "symbol",
+ "source": "markers",
+ "layout": {
+ "icon-image": "{icon}-15"
+ }
+ });
+ });
+ });
+ });
+ </script>
+ </div>
diff --git a/layouts/shortcodes/rate.html b/layouts/shortcodes/rate.html
new file mode 100644
index 0000000..bdce5b7
--- /dev/null
+++ b/layouts/shortcodes/rate.html
@@ -0,0 +1,13 @@
+<i class="material-icons">
+{{ range seq (.Get 0) }}
+star
+{{ end }}
+{{ $len := 5 }}
+{{ if and (.Get 1) (eq "halb" (.Get 1)) }}{{ $len := 4 }}{{ end }}
+{{ if eq 4 $len }}
+star_half
+{{ end }}
+{{ range seq (sub $len (int (.Get 0))) }}
+star_border
+{{ end }}
+</i>
diff --git a/themes/flog/layouts/partials/header.html b/themes/flog/layouts/partials/header.html
index 5a32775..03331a0 100644
--- a/themes/flog/layouts/partials/header.html
+++ b/themes/flog/layouts/partials/header.html
@@ -5,6 +5,7 @@
{{ .Hugo.Generator }}
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<link rel="stylesheet" type="text/css" href="/css/materialize-0.97.7.min.css">
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="alternate" href="/index.xml" type="application/rss+xml" title="{{ .Site.Title }}">
<title>{{ .Title }}{{ if not .IsHome }} - {{ .Site.Title }}{{ end }}</title>
</head>