From 415b995a0b6e7d77efc25040041a03c37bec9544 Mon Sep 17 00:00:00 2001 From: Brandon Rosage Date: Mon, 4 Mar 2019 13:30:19 -0600 Subject: [PATCH] add support for dynamic "share" links on posts --- _includes/social_media_share_url.html | 13 +++++++++++++ _layouts/post.html | 16 ++++++++++++++++ _sass/_highlight-syntax.scss | 6 +++--- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 _includes/social_media_share_url.html diff --git a/_includes/social_media_share_url.html b/_includes/social_media_share_url.html new file mode 100644 index 0000000..53de80a --- /dev/null +++ b/_includes/social_media_share_url.html @@ -0,0 +1,13 @@ +{% if include.service == 'facebook' %} + {% capture share_url %} + https://www.facebook.com/sharer/sharer.php?u={{ include.permalink | prepend: site.url | prepend: site.baseurl | url_encode }} + {% endcapture %} +{% elsif include.service == 'linkedin' %} + {% capture share_url %} + https://www.linkedin.com/shareArticle?mini=true&url={{ include.permalink | prepend: site.url | prepend: site.baseurl | url_encode }}&title={{ include.title | url_encode }}&source=LinkedIn + {% endcapture %} +{% elsif include.service == 'twitter' %} + {% capture share_url %} + https://twitter.com/share?text={{ include.title | url_encode }}&url={{ include.permalink | prepend: site.url | prepend: site.baseurl | url_encode }} + {% endcapture %} +{% endif %}{{ share_url | strip }} diff --git a/_layouts/post.html b/_layouts/post.html index acda2f7..0a79233 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -24,6 +24,22 @@

{% octicon chevron-left height:16 class:"mr-2 v-align-middle" fill:{{ icon_color }} aria-label:Home %}Home

{{ page.title }}

Published {{ page.date | date: "%b %d, %Y"}}

+ {% if site.social_media %} +
+

Share

+ +
+ {% endif %}
{{ content }}
diff --git a/_sass/_highlight-syntax.scss b/_sass/_highlight-syntax.scss index 8898a10..3889da8 100644 --- a/_sass/_highlight-syntax.scss +++ b/_sass/_highlight-syntax.scss @@ -1,4 +1,4 @@ -.highlight { background: #ffffff; } +.highlight { width: 100%; overflow: auto; background: #ffffff; } .highlight .c { color: #999988; font-style: italic } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { font-weight: bold } /* Keyword */ @@ -60,6 +60,6 @@ .highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ /* Make line numbers unselectable: excludes line numbers from copy-paste user ops */ -.highlight .lineno {-webkit-user-select: none;-moz-user-select: none; -o-user-select: none;} +.highlight .lineno {-webkit-user-select: none;-moz-user-select: none; -o-user-select: none;} .lineno::-moz-selection {background-color: transparent;} /* Mozilla specific */ -.lineno::selection {background-color: transparent;} /* Other major browsers */ \ No newline at end of file +.lineno::selection {background-color: transparent;} /* Other major browsers */