diff options
author | Bing-Sheng Chen <gundamew@gmail.com> | 2018-12-18 11:28:43 +0300 |
---|---|---|
committer | Bing-Sheng Chen <gundamew@gmail.com> | 2018-12-18 11:28:43 +0300 |
commit | 1a5e91d7705901d5ef7b0bafe5011df59fe6e27c (patch) | |
tree | a418868016b478eb9d0e4ff962e64e79f7ced2ab | |
parent | 88c00b4203c8ea4ec712251d9b9f94a0acb0a99c (diff) |
Change the way to display social networksv1.3.0
1. Add more social icons
2. Sort social networks in config file
-rw-r--r-- | README.md | 50 | ||||
-rw-r--r-- | exampleSite/config.toml | 31 | ||||
-rw-r--r-- | layouts/_default/social-links.html | 36 | ||||
-rw-r--r-- | layouts/index.html | 2 | ||||
-rw-r--r-- | static/img/bitbucket.svg | 1 | ||||
-rw-r--r-- | static/img/gitlab.svg | 1 | ||||
-rw-r--r-- | static/img/keybase.svg | 1 | ||||
-rw-r--r-- | static/img/plurk.svg | 1 | ||||
-rw-r--r-- | static/img/stackexchange.svg | 1 |
9 files changed, 73 insertions, 51 deletions
@@ -25,6 +25,15 @@ This theme includes Hugo [internal template](https://gohugo.io/templates/interna googleAnalytics = "UA-123-45" ``` +### Use Gravatar + +```toml +[params] + + [params.gravatar] + email = "hugo@example.com" +``` + ### Custom navbar ```toml @@ -43,21 +52,44 @@ googleAnalytics = "UA-123-45" weight = 20 ``` -### Add social networks +### Display social networks -You can put social network links on home page: +You can put social network links on home page. It will sort by weight in ascending order, like navbar. ```toml [params] - email = "username@domain" # for Gravatar - github = "github_username" - linkedin = "linkedin_username" - medium = "medium_username" - twitter = "twitter_username" - facebook = "facebook_username" - instagram = "instagram_username" + + [[params.social]] + icon = "github" + url = "https://github.com/example" + weight = 10 + + [[params.social]] + icon = "twitter" + url = "https://twitter.com/example" + weight = 30 + + [[params.social]] + icon = "linkedin" + url = "https://www.linkedin.com/in/example" + weight = 20 ``` +Available social icons: + +* Bitbucket +* Facebook +* GitHub +* GitLab +* Instagram +* Keybase +* LinkedIn +* Medium +* Plurk +* Stack Exchange +* Stack Overflow +* Twitter + ## Built With * [Highlight.js](https://highlightjs.org/) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index aaffdb9..f905fbd 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -27,11 +27,26 @@ googleAnalytics = "UA-123-45" weight = 20 [params] - email = "username@domain" - github = "github_username" - linkedin = "linkedin_username" - medium = "medium_username" - twitter = "twitter_username" - facebook = "facebook_username" - instagram = "instagram_username" - stackoverflow = "stackoverflow_user_number" + + [params.gravatar] + email = "hugo@example.com" + + [[params.social]] + icon = "github" + url = "https://github.com/example" + weight = 10 + + [[params.social]] + icon = "twitter" + url = "https://twitter.com/example" + weight = 30 + + [[params.social]] + icon = "stackoverflow" + url = "https://stackoverflow.com/story/example" + weight = 40 + + [[params.social]] + icon = "linkedin" + url = "https://www.linkedin.com/in/example" + weight = 20 diff --git a/layouts/_default/social-links.html b/layouts/_default/social-links.html index 83c8882..3d87747 100644 --- a/layouts/_default/social-links.html +++ b/layouts/_default/social-links.html @@ -1,37 +1,7 @@ <div class="social-media-links"> - {{ with .Site.Params.github }} - <a class="social-media" href="https://github.com/{{ . }}"> - <img src="{{ "img/github.svg" | absURL }}" alt="github"> - </a> - {{ end }} - {{ with .Site.Params.linkedin }} - <a class="social-media" href="https://www.linkedin.com/in/{{ . }}"> - <img src="{{ "img/linkedin.svg" | absURL }}" alt="linkedin"> - </a> - {{ end }} - {{ with .Site.Params.medium }} - <a class="social-media" href="https://medium.com/{{ . }}"> - <img src="{{ "img/medium.svg" | absURL }}" alt="medium"> - </a> - {{ end }} - {{ with .Site.Params.twitter }} - <a class="social-media" href="https://twitter.com/{{ . }}"> - <img src="{{ "img/twitter.svg" | absURL }}" alt="twitter"> - </a> - {{ end }} - {{ with .Site.Params.stackoverflow }} - <a class="social-media" href="https://stackoverflow.com/users/{{ . }}"> - <img src="{{ "img/stackoverflow.svg" | absURL }}" alt="stackoverflow"> - </a> - {{ end }} - {{ with .Site.Params.facebook }} - <a class="social-media" href="https://facebook.com/{{ . }}"> - <img src="{{ "img/facebook.svg" | absURL }}" alt="facebook"> - </a> - {{ end }} - {{ with .Site.Params.instagram }} - <a class="social-media" href="https://instagram.com/{{ . }}"> - <img src="{{ "img/instagram.svg" | absURL }}" alt="instagram"> + {{ range sort .Site.Params.social "weight" }} + <a class="social-media" href="{{ .url }}"> + <img src="{{ printf "img/%s.svg" .icon | absURL }}" alt="{{ .icon }}"> </a> {{ end }} </div> diff --git a/layouts/index.html b/layouts/index.html index 48e0a63..3604f74 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,7 +2,7 @@ <main id="home"> <div> <div class="avatar"> - <img src="https://www.gravatar.com/avatar/{{ md5 .Site.Params.email }}?s=240&d=mp" alt="gravatar"> + <img src="https://www.gravatar.com/avatar/{{ md5 .Site.Params.gravatar.email }}?s=240&d=mp" alt="gravatar"> </div> <div id="content"> {{ .Content }} diff --git a/static/img/bitbucket.svg b/static/img/bitbucket.svg new file mode 100644 index 0000000..df3b42f --- /dev/null +++ b/static/img/bitbucket.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Bitbucket icon</title><path d="M.778 1.211c-.424-.006-.772.334-.778.758 0 .045.002.09.01.134l3.263 19.811c.084.499.515.867 1.022.872H19.95c.382.004.708-.271.77-.646l3.27-20.03c.068-.418-.216-.813-.635-.881-.045-.008-.089-.011-.133-.01L.778 1.211zM14.52 15.528H9.522L8.17 8.464h7.561l-1.211 7.064z"/></svg>
\ No newline at end of file diff --git a/static/img/gitlab.svg b/static/img/gitlab.svg new file mode 100644 index 0000000..987c459 --- /dev/null +++ b/static/img/gitlab.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitLab icon</title><path d="M23.955 13.587l-1.342-4.135-2.664-8.189c-.135-.423-.73-.423-.867 0L16.418 9.45H7.582L4.919 1.263C4.783.84 4.185.84 4.05 1.26L1.386 9.449.044 13.587c-.121.375.014.789.331 1.023L12 23.054l11.625-8.443c.318-.235.453-.647.33-1.024"/></svg>
\ No newline at end of file diff --git a/static/img/keybase.svg b/static/img/keybase.svg new file mode 100644 index 0000000..687db4a --- /dev/null +++ b/static/img/keybase.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Keybase icon</title><path d="M10.446 21.371c0 .528-.428.953-.954.953-.525 0-.954-.425-.954-.953 0-.526.428-.954.953-.954.524 0 .951.431.951.955m5.922-.001c0 .528-.428.953-.955.953-.526 0-.952-.425-.952-.953 0-.526.423-.954.949-.954s.954.431.954.955"/><path d="M20.904 12.213l-.156-.204c-.046-.06-.096-.116-.143-.175-.045-.061-.094-.113-.141-.169-.104-.12-.209-.239-.319-.359l-.076-.08-.091-.099-.135-.131c-.015-.018-.032-.034-.05-.053-1.16-1.139-2.505-1.986-3.955-2.504l-.23-.078c.012-.027.024-.055.035-.083.41-1.064.367-2.223-.12-3.255-.491-1.035-1.356-1.8-2.438-2.16-.656-.216-1.23-.319-1.711-.305-.033-.105-.1-.577.496-1.848L10.663 0l-.287.399c-.33.455-.648.895-.945 1.328-.328-.345-.766-.552-1.245-.58L6.79 1.061h-.012c-.033-.003-.07-.003-.104-.003-.99 0-1.81.771-1.87 1.755l-.088 1.402v.003c-.061 1.029.727 1.915 1.755 1.979l1.002.061c-.065.84.073 1.62.405 2.306-1.346.562-2.586 1.401-3.66 2.484C.913 14.391.913 18.051.913 20.994v1.775l1.305-1.387c.266.93.652 1.807 1.145 2.615H5.06c-.833-1.114-1.419-2.426-1.68-3.848l1.913-2.03-.985 3.091 1.74-1.268c3.075-2.234 6.744-2.75 10.91-1.529 1.805.532 3.56.039 4.473-1.257l.104-.165c.091.498.141.998.141 1.496 0 1.563-.255 3.687-1.38 5.512h1.611c.776-1.563 1.181-3.432 1.181-5.512-.001-2.199-.786-4.421-2.184-6.274zM8.894 6.191c.123-1.002.578-1.949 1.23-2.97.025.05.054.097.084.144.264.398.713.625 1.199.605.217-.008.605.025 1.233.232.714.236 1.286.744 1.608 1.425s.349 1.442.079 2.149c-.173.445-.454.82-.806 1.109l-.408-.502-.002-.003c-.279-.341-.694-.535-1.134-.535-.335 0-.664.117-.925.33-.334.27-.514.66-.534 1.058-1.2-.541-1.8-1.643-1.628-3.041l.004-.001zm4.304 5.11l-.519.425c-.046.036-.095.053-.146.053-.066 0-.133-.03-.177-.085l-.111-.135c-.083-.1-.067-.25.034-.334l.51-.42-1.055-1.299c-.109-.133-.091-.33.044-.436.058-.048.126-.072.194-.072.091 0 .181.038.24.113l2.963 3.645c.109.135.09.33-.042.436-.039.029-.082.053-.126.063-.023.006-.045.009-.07.009-.09 0-.178-.04-.24-.113l-.295-.365-1.045.854c-.046.037-.1.055-.154.055-.068 0-.139-.03-.186-.09l-.477-.579c-.082-.102-.068-.252.035-.336l1.051-.857-.426-.533-.002.001zM7.753 4.866l-1.196-.075c-.255-.015-.45-.235-.435-.488l.09-1.401c.014-.245.216-.436.461-.436h.024l1.401.091c.123.006.236.06.317.152.083.094.123.21.116.336l-.007.101c-.32.567-.585 1.134-.773 1.72h.002zm12.524 11.481c-.565.805-1.687 1.081-2.924.718-3.886-1.141-7.396-.903-10.468.701l1.636-5.123-5.291 5.609c.099-3.762 2.453-6.966 5.758-8.311.471.373 1.034.66 1.673.841.16.044.322.074.48.102-.183.458-.119.997.21 1.407l.075.09c-.172.45-.105.975.221 1.374l.475.582c.266.325.659.513 1.079.513.321 0 .635-.111.886-.314l.285-.232c.174.074.367.113.566.113.113 0 .222-.01.33-.035.218-.05.424-.15.598-.291.623-.51.72-1.435.209-2.06l-1.67-2.056c.145-.117.281-.244.408-.381.135.037.271.078.4.12.266.097.533.198.795.315 1.005.445 1.954 1.1 2.771 1.897.029.03.059.055.085.083l.17.175c.038.039.076.079.111.12.079.085.16.175.239.267l.126.15c.045.053.086.104.13.16l.114.15c.04.051.079.102.117.154.838 1.149.987 2.329.404 3.157v.005z"/><path d="M7.719 4.115l-.835-.051.053-.835.834.051-.052.835z"/></svg>
\ No newline at end of file diff --git a/static/img/plurk.svg b/static/img/plurk.svg new file mode 100644 index 0000000..d871b98 --- /dev/null +++ b/static/img/plurk.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Plurk icon</title><path d="M12.902 1.906a10.065 10.065 0 0 0-7.88 3.707 10.18 10.18 0 0 0-.283.357l.004-.003c.232-.196.473-.345.717-.445l.058-.023c.299-.112.602-.147.9-.088 1.44.289 2.19 2.609 1.675 5.183-.515 2.574-2.1 4.427-3.54 4.139-1.01-.202-1.678-1.405-1.812-2.992v-.005.052c-.003.132-.003.266 0 .4v.073l.002.059c.005.149.013.296.024.443.005.067.012.134.019.2a10.032 10.032 0 0 0 .961 3.443c.06.126.03.276-.078.363l-.277.226a.906.906 0 0 0-.29.97c0 .006.003.01.006.017a.955.955 0 0 0 .059.142l.05-.039.23-.174a.261.261 0 1 1 .316.416l-.245.186-.037.028 1.177 1.448a.91.91 0 0 0 1.275.131l.258-.21a.298.298 0 0 1 .374 0 10.05 10.05 0 0 0 6.527 2.181 10.042 10.042 0 0 0 5.572-1.855.298.298 0 0 1 .38.025l.163.156a.909.909 0 0 0 1.179.059l-.004-.004-.21-.197a.262.262 0 0 1 .358-.382l.225.21 1.26-1.326a.91.91 0 0 0-.033-1.282l-.263-.25a.297.297 0 0 1-.054-.36 10.06 10.06 0 0 0 1.103-6.671c.301-.278.853-.824 1.069-1.292.231-.502.29-1.02-.323-.792-.476.177-.842.291-1.286.19-1.417-3.593-4.847-6.193-8.851-6.4a9.71 9.71 0 0 0-.473-.014zM2.265 6.247a1.228 1.228 0 0 0-1.082 1.764 1.23 1.23 0 1 0 .754 2.236c.177-.124.306-.289.395-.47.186.342.46.627.778.823a5.59 5.59 0 0 0 .017.6c.102 1.228.62 2.16 1.401 2.316 1.114.223 2.34-1.21 2.738-3.2.399-1.99-.181-3.784-1.295-4.007-.434-.087-.885.08-1.298.432-.45.383-.854.988-1.14 1.73-.01-.002-.02-.003-.03-.007-.14-.04-.215-.131-.312-.152a1.23 1.23 0 0 0-.926-2.065zm2.862 1.244c.054 0 .107.004.16.015.726.143 1.104 1.312.844 2.608-.259 1.298-1.058 2.23-1.783 2.085-.493-.098-.824-.67-.905-1.433.181.07.37.113.56.122.527.024.871-.154 1.14-.513.346-.465.084-1.753-.374-1.92-.356-.13-.567.027-.884.05.16-.298.351-.544.557-.72.219-.185.453-.292.686-.295z"/></svg>
\ No newline at end of file diff --git a/static/img/stackexchange.svg b/static/img/stackexchange.svg new file mode 100644 index 0000000..eed94d4 --- /dev/null +++ b/static/img/stackexchange.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Stack Exchange icon</title><path d="M21.728 15.577v1.036c0 1.754-1.395 3.177-3.1 3.177h-.904L13.645 24v-4.21H5.371c-1.704 0-3.099-1.423-3.099-3.181v-1.032h19.456zM2.275 10.463h19.323v3.979H2.275v-3.979zm0-5.141h19.323v3.979H2.275V5.322zM18.575 0c1.681 0 3.023 1.42 3.023 3.178v1.034H2.275V3.178C2.275 1.422 3.67 0 5.375 0h13.2z"/></svg>
\ No newline at end of file |