diff options
| author | Christine Dodrill <me@christine.website> | 2020-09-19 11:33:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-19 11:33:46 -0400 |
| commit | a2fba89738caac83ce24d40b762d6205f2266361 (patch) | |
| tree | 3a61afb3b1a9d42b0a61b67be527322b6740f179 /templates | |
| parent | 1e61d2ad33f7ac7751063bdd373ab3d1305015e2 (diff) | |
| download | xesite-a2fba89738caac83ce24d40b762d6205f2266361.tar.xz xesite-a2fba89738caac83ce24d40b762d6205f2266361.zip | |
TL;DR Rust (#210)
* start mara code
* better alt text
* more mara tests
* cleanups
* blog: start tl;dr rust post
* more words
* feature complete
* little oopses
* oops lol
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/blogpost.rs.html | 91 | ||||
| -rw-r--r-- | templates/mara.rs.html | 21 |
2 files changed, 67 insertions, 45 deletions
diff --git a/templates/blogpost.rs.html b/templates/blogpost.rs.html index 6b55850..d90a8e3 100644 --- a/templates/blogpost.rs.html +++ b/templates/blogpost.rs.html @@ -62,61 +62,62 @@ <p>Tags: @for tag in post.front_matter.tags.as_ref().unwrap() { <code>@tag</code> }</p> } -<script> +<p>The art for Mara was drawn by <a href="https://selic.re/">Selicre</a>.</p> -// The actual function. Set this as an onclick function for your "Share on Mastodon" button -function share_on_mastodon() @{ +<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://"; + 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 = "#blogpost"; - - @if post.front_matter.series.is_some() { - hashtags += "#@post.front_matter.series.as_ref().unwrap()"; - } - - @if post.front_matter.tags.is_some() { - hashtags += "@for tag in post.front_matter.tags.as_ref().unwrap() { #@tag }"; - } - - // 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'); + // 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 = "#blogpost"; + + @if post.front_matter.series.is_some() { + hashtags += "#@post.front_matter.series.as_ref().unwrap()"; + } + + @if post.front_matter.tags.is_some() { + hashtags += "@for tag in post.front_matter.tags.as_ref().unwrap() { #@tag }"; + } + + // 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> @:footer_html() diff --git a/templates/mara.rs.html b/templates/mara.rs.html new file mode 100644 index 0000000..1786d6f --- /dev/null +++ b/templates/mara.rs.html @@ -0,0 +1,21 @@ +@(mood: &str, character: &str, message: Html<String>) +<div class="grid conversation"> + <div class="cell -2of12"> + <div class="content"> + <picture> + <source srcset="https://cdn.christine.website/file/christine-static/stickers/@character.to_lowercase()/@(mood).webp" height="75%" width="75%" type="image/webp"> + <img src="https://cdn.christine.website/file/christine-static/stickers/@character.to_lowercase()/@(mood).png" height="75%" width="75%" alt="@character is @mood"> + </picture> + </div> + </div> + <div class="cell -10of12"> + <div class="content"> + <p> + <b>@character</b> + </p> + <blockquote> + @message + </blockquote> + </div> + </div> +</div> |
