diff options
author | Raghd Hamzeh <raghd@rhamzeh.com> | 2018-07-21 21:01:49 +0300 |
---|---|---|
committer | Raghd Hamzeh <raghd@rhamzeh.com> | 2018-07-21 22:53:03 +0300 |
commit | 7b7a8de93db2b2dada1778c750ff3b866aabcba6 (patch) | |
tree | 6566db47e4cf299540564c8550273de02c72a4f0 | |
parent | 5c1f6bb19ca56f42c0533b384e1aaedc08a7d842 (diff) |
Added option to enable schema.org social profile links
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/partials/social.html | 45 |
3 files changed, 46 insertions, 1 deletions
@@ -150,6 +150,7 @@ These settings for extra features that this site uses. - `rss`: Enable rss icon next to social accounts. - `poweredby`: Help promote this theme and give the authors credit. eg. `true` or `false`. - `highlightjs`: Use highlightJS to highlight code on your site. eg. `true` or `false`. +- `socialmarkup`: Adds links that conform to the [Schema.org](schema.org) markup. See this [link](https://developers.google.com/search/docs/data-types/social-profile) for more. ### Main Menu `[[menu.main]]` diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 737d34c..2a093ae 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -71,6 +71,7 @@ email = "you@example.com" copyright = "© 2016. Erlich Bachman. [Some Rights Reserved](http://creativecommons.org/licenses/by/3.0/)." poweredby = true highlightjs = true +socialmarkup = true ## Main Menu [[menu.main]] diff --git a/layouts/partials/social.html b/layouts/partials/social.html index 47ac280..ac25c11 100644 --- a/layouts/partials/social.html +++ b/layouts/partials/social.html @@ -104,4 +104,47 @@ {{ if and ( .Site.Params.extra.rss ) ( .RSSLink ) }} <a href="{{ .RSSLink }}" aria-label="RSS" target="_blank"><i class="fas fa-rss" aria-hidden="true"></i></a> {{ end }} -</section>
\ No newline at end of file +</section> +{{ if .Site.Params.extra.socialmarkup }} +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "Person", + "name": "{{ .Site.Params.author }}", + "url": "{{ .Site.Params.baseURL }}", + "sameAs": [ + {{ with .Site.Params.social.twitter }}"https://twitter.com/{{.}}",{{ end }} + {{ with .Site.Params.social.google }}"https://plus.google.com/{{.}}/about",{{ end }} + {{ with .Site.Params.social.goodreads }}"https://www.goodreads.com/user/show/{{.}}",{{ end }} + {{ with .Site.Params.social.lastfm }}"https://www.last.fm/user/{{.}}/",{{ end }} + {{ with .Site.Params.social.facebook }}"https://facebook.com/{{.}}",{{ end }} + {{ with .Site.Params.social.github }}"https://github.com/{{.}}",{{ end }} + {{ with .Site.Params.social.instagram }}"https://instagram.com/{{.}}",{{ end }} + {{ with .Site.Params.social.linkedin }}"https://linkedin.com/in/{{.}}",{{ end }} + {{ with .Site.Params.social.stackoverflow }}"https://stackoverflow.com/users/{{.}}",{{ end }} + {{ with .Site.Params.social.medium}}"https://medium.com/{{.}}",{{ end }} + {{ with .Site.Params.social.devto}}"https://dev.to/{{.}}",{{ end }} + {{ with .Site.Params.social.angellist}}"https://angel.co/{{.}}",{{ end }} + {{ with .Site.Params.social.xing }}"https://www.xing.com/profile/{{.}}",{{ end }} + {{ with .Site.Params.social.gitlab}}"https://gitlab.com/{{.}}",{{ end }} + {{ with .Site.Params.social.bitbucket}}"https://bitbucket.org/{{.}}",{{ end }} + {{ with .Site.Params.social.fivehundredpx}}"https://500px.com/{{.}}",{{ end }} + {{ with .Site.Params.social.flickr}}"https://flickr.com/photos/{{.}}",{{ end }} + {{ with .Site.Params.social.foursquare}}"https://foursquare.com/{{.}}",{{ end }} + {{ with .Site.Params.social.hackernews}}"https://news.ycombinator.com/user?id={{.}}",{{ end }} + {{ with .Site.Params.social.kickstarter}}"https://kickstarter.com/{{.}}",{{ end }} + {{ with .Site.Params.social.patreon}}"https://patreon.com/{{.}}",{{ end }} + {{ with .Site.Params.social.pintrest}}"https://pintrest.com/{{.}}",{{ end }} + {{ with .Site.Params.social.steam}}"https://steamcommunity.com/id/{{.}}",{{ end }} + {{ with .Site.Params.social.reddit}}"https://www.reddit.com/user/{{.}}",{{ end }} + {{ with .Site.Params.social.snapchat}}"https://snapchat.com{{.}}",{{ end }} + {{ with .Site.Params.social.youtube}}"https://youtube.com/user/{{.}}",{{ end }} + {{ with .Site.Params.social.keybase}}"https://keybase.io/{{.}}",{{ end }} + {{ with .Site.Params.social.twitch}}"https://www.twitch.tv/{{.}}",{{ end }} + {{ with .Site.Params.social.soundcloud}}"https://soundcloud.com/{{.}}",{{ end }} + {{ with .Site.Params.social.tumblr}}"https://{{.}}.tumblr.com",{{ end }} + "{{ .Site.Params.baseURL }}" + ] +} +</script> +{{ end }} |