diff options
| author | Christine Dodrill <me@christine.website> | 2019-11-01 17:48:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-01 17:48:19 -0400 |
| commit | 5f4ee89e57060dc9c119d84ac5700784c343b8d9 (patch) | |
| tree | 2a18debdceae9d538d0e9a9c451c10022de472ee /templates | |
| parent | 42371916d83af7fc2e4ca053d963e6cfab15a8f1 (diff) | |
| download | xesite-5f4ee89e57060dc9c119d84ac5700784c343b8d9.tar.xz xesite-5f4ee89e57060dc9c119d84ac5700784c343b8d9.zip | |
Art gallery (#91)
* implement art gallery
* update dates
* gallery: update tags
* gofmt
* templates/gallerypost: add hashtags
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/base.html | 2 | ||||
| -rw-r--r-- | templates/galleryindex.html | 25 | ||||
| -rw-r--r-- | templates/gallerypost.html | 116 |
3 files changed, 142 insertions, 1 deletions
diff --git a/templates/base.html b/templates/base.html index 3fdc591..f4d0a46 100644 --- a/templates/base.html +++ b/templates/base.html @@ -59,7 +59,7 @@ {{ template "scripts" . }} <div class="container"> <header> - <p><a href="/">Christine Dodrill</a> - <a href="/blog">Blog</a> - <a href="/contact">Contact</a> - <a href="/resume">Resume</a> - <a href="/talks">Talks</a> | <a target="_blank" rel="noopener noreferrer" href="https://graphviz.christine.website">GraphViz</a> - <a target="_blank" rel="noopener noreferrer" href="https://when-then-zen.christine.website/">When Then Zen</a></p> + <p><a href="/">Christine Dodrill</a> - <a href="/blog">Blog</a> - <a href="/contact">Contact</a> - <a href="/gallery">Gallery</a> - <a href="/resume">Resume</a> - <a href="/talks">Talks</a> | <a target="_blank" rel="noopener noreferrer" href="https://graphviz.christine.website">GraphViz</a> - <a target="_blank" rel="noopener noreferrer" href="https://when-then-zen.christine.website/">When Then Zen</a></p> </header> <div class="snowframe"> diff --git a/templates/galleryindex.html b/templates/galleryindex.html new file mode 100644 index 0000000..e3c1f33 --- /dev/null +++ b/templates/galleryindex.html @@ -0,0 +1,25 @@ +{{ define "title" }} +<title>Gallery - Christine Dodrill</title> +{{ end }} + +{{ define "content" }} +<h1>Gallery</h1> + +<p>Here are links to all of the art I have done in the last few years.</p> + +<p>If you have a compatible reader, be sure to check out my <a href="/blog.rss">RSS Feed</a> for automatic updates. Also check out the <a href="/blog.json">JSONFeed</a>.</p> + +<p> + <div class="grid"> + {{ range . }} + <div class="card cell -4of12 blogpost-card"> + <header class="card-header">{{ .Title }}</header> + <div class="card-content"> + <center><p>Posted on {{ .DateString }} <br><a href="{{ .Link }}"><img src="{{ .ThumbURL }}" /></a></p></center> + </div> + </div> + {{ end }} + </div> +</p> + +{{ end }} diff --git a/templates/gallerypost.html b/templates/gallerypost.html new file mode 100644 index 0000000..f4c93b8 --- /dev/null +++ b/templates/gallerypost.html @@ -0,0 +1,116 @@ +{{ define "title" }} +<title>{{ .Title }} - Christine Dodrill</title> + +<!-- Twitter --> +<meta name="twitter:card" content="summary" /> +<meta name="twitter:site" content="@theprincessxena" /> +<meta name="twitter:title" content="{{ .Title }}" /> +<meta name="twitter:description" content="Posted on {{ .Date }}" /> + +<!-- Facebook --> +<meta property="og:type" content="website" /> +<meta property="og:title" content="{{ .Title }}" /> +<meta property="og:site_name" content="Talk by Christine Dodrill" /> + +<!-- Description --> +<meta name="description" content="{{ .Title }} - Talk by Christine Dodrill" /> +<meta name="author" content="Christine Dodrill"> + +<link rel="canonical" href="https://christine.website/{{ .Link }}"> + +<script type="application/ld+json"> + { + "@context": "http://schema.org", + "@type": "Painting", + "headline": "{{ .Title }}", + "image": "https://christine.website{{ .Image }}", + "url": "https://christine.website/{{ .Link }}", + "datePublished": "{{ .Date }}", + "mainEntityOfPage": { + "@type": "", + "@id": "https://christine.website{{ .Image }}" + }, + "creator": { + "@type": "Person", + "name": "Christine Dodrill" + }, + "publisher": { + "@type": "Person", + "name": "Christine Dodrill" + } + } +</script> +{{ end }} + +{{ define "content" }} + +<h1>{{ .Title }}</h1> + +{{ .BodyHTML }} + +<center> + <img src="{{ .Image }}" /> +</center> + +<hr /> + +<!-- The button that should be clicked. --> +<button onclick="share_on_mastodon()">Share on Mastodon</button> + +<p>This artwork was posted on {{ .Date }}.</p> + +{{ if ne .Tags "" }} +<p>Tags:{{.Tags}}</p> +{{ end }} + +<script> + +// The actual function. Set this as an onclick function for your "Share on Mastodon" button +function share_on_mastodon() { + // Prefill the form with the user's previously-specified Mastodon instance, if applicable + var default_url = localStorage['mastodon_instance']; + + // If there is no cached instance/domain, then insert a "https://" with no domain at the start of the prompt. + if (!default_url) + default_url = "https://"; + + var instance = prompt("Enter your instance's address: (ex: https://linuxrocks.online)", default_url); + if (instance) { + // Handle URL formats + if ( !instance.startsWith("https://") && !instance.startsWith("http://") ) + instance = "https://" + instance; + + // Get the current page's URL + var url = window.location.href; + + // Get the page title from the og:title meta tag, if it exists. + var title = document.querySelectorAll('meta[property="og:title"]')[0].getAttribute("content"); + + // Otherwise, use the <title> tag as the title + if (!title) var title = document.getElementsByTagName("title")[0].innerHTML; + + // Handle slash + if ( !instance.endsWith("/") ) + instance = instance + "/"; + + // Cache the instance/domain for future requests + localStorage['mastodon_instance'] = instance; + + // Hashtags + var hashtags = "#art"; + {{ if ne .Tags "" }}hashtags += " {{ .Tags }}";{{ end }} + + // Tagging users, such as offical accounts or the author of the post + var author = "@cadey@mst3k.interlinked.me"; + + // Create the Share URL + // https://someinstance.tld/share?text=URL%20encoded%20text + mastodon_url = instance + "share?text=" + encodeURIComponent(title + "\n\n" + url + "\n\n" + hashtags + " " + author); + + // Open a new window at the share location + window.open(mastodon_url, '_blank'); + } +} +</script> + +{{ end }} |
