diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index 7ead8a52..9b24fb74 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -339,7 +339,7 @@ In order to add images to the gallery, use `img` tags for each image and add `cl ## GitLab Card -`gitlab` allows you to quickly link a GitLab Project (GitLab's jargon for repo). +`gitlab` allows you to quickly link a GitLab Project (GitLab's jargon for repo). It displays realtime stats about it, such as the number of stars and forks it has. Unlike `github` it can't display the main programming language of a project. Finally, custom GitLab instance URL can be provided, as long as the `api/v4/projects/` endpoint is available, making this shortcode compatible with most self-hosted / enterprise deployments. @@ -461,7 +461,7 @@ When life gives you lemons, make lemonade. When life gives you lemons, make lemonade. {{< /lead >}} -


+


## List @@ -500,7 +500,7 @@ The `where` and `value` values are used in the following query `where .Site.Regu


-## LTR/RTL +## LTR/RTL `ltr` and `rtl` allows you to mix your contents. Many RTL language users want to include parts of the content in LTR. Using this shortcode will let you do so, and by leveraging `%` as the outer-most dilemeter in the shortcode [Hugo shortcodes](https://gohugo.io/content-management/shortcodes/#shortcodes-with-markdown), any markdown inside will be rendered normally. @@ -577,6 +577,28 @@ You can see some additional Mermaid examples on the [diagrams and flowcharts sam


+## Social Link + +`sociallink` creates an anchor link for author socials from the config file, using the name param. + + +| Parameter | Description | +| ----------- | ----------------------------------------------------------------- | +| `name` | **Required.** Name of the social link as mentioned in config file | +| `showIcon` | `showIcon=true` will add icon to the anchor text. Default: false | + + +**Example** + +```md +{{}}Github{{}} +``` + +**Output** +{{< sociallink name="github" showIcon=true >}}Github{{< /sociallink >}} + +


+ ## Swatches `swatches` outputs a set of up to three different colors to showcase color elements like a color palette. This shortcode takes the `HEX` codes of each color and creates the visual elements for each. @@ -613,7 +635,7 @@ The `timeline` creates a visual timeline that can be used in different use-cases {{}} {{}} -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus non magna ex. Donec sollicitudin ut lorem quis lobortis. Nam ac ipsum libero. Sed a ex eget ipsum tincidunt venenatis quis sed nisl. Pellentesque sed urna vel odio consequat tincidunt id ut purus. Nam sollicitudin est sed dui interdum rhoncus. +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus non magna ex. Donec sollicitudin ut lorem quis lobortis. Nam ac ipsum libero. Sed a ex eget ipsum tincidunt venenatis quis sed nisl. Pellentesque sed urna vel odio consequat tincidunt id ut purus. Nam sollicitudin est sed dui interdum rhoncus. {{}} @@ -650,7 +672,7 @@ With other shortcodes {{< timeline >}} {{< timelineItem icon="github" header="header" badge="badge test" subheader="subheader" >}} -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus non magna ex. Donec sollicitudin ut lorem quis lobortis. Nam ac ipsum libero. Sed a ex eget ipsum tincidunt venenatis quis sed nisl. Pellentesque sed urna vel odio consequat tincidunt id ut purus. Nam sollicitudin est sed dui interdum rhoncus. +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus non magna ex. Donec sollicitudin ut lorem quis lobortis. Nam ac ipsum libero. Sed a ex eget ipsum tincidunt venenatis quis sed nisl. Pellentesque sed urna vel odio consequat tincidunt id ut purus. Nam sollicitudin est sed dui interdum rhoncus. {{}} @@ -708,7 +730,7 @@ Blowfish implements a sub-set of TypeIt features using a `shortcode`. Write your ```md {{}} -Lorem ipsum dolor sit amet +Lorem ipsum dolor sit amet {{}} ``` @@ -719,12 +741,12 @@ Lorem ipsum dolor sit amet **Example 2:** ```md -{{}} -Lorem ipsum dolor sit amet, -consectetur adipiscing elit. +Lorem ipsum dolor sit amet, +consectetur adipiscing elit. {{}} ``` @@ -739,14 +761,14 @@ consectetur adipiscing elit. **Example 3:** ```md -{{}} -Lorem ipsum dolor sit amet, -consectetur adipiscing elit. +Lorem ipsum dolor sit amet, +consectetur adipiscing elit. {{}} ``` diff --git a/layouts/shortcodes/sociallink.html b/layouts/shortcodes/sociallink.html new file mode 100644 index 00000000..b5738328 --- /dev/null +++ b/layouts/shortcodes/sociallink.html @@ -0,0 +1,24 @@ +{{ $name := .Get "name" }} +{{ if not $name }} {{ errorf "Sociallink shortcode: name param not found" }} {{ end }} +{{ $url := false }} +{{ with .Site.Author.links }} + {{ range $links := . }} + {{ range $s_name, $s_url := $links }} + {{ if eq $s_name $name }} {{ $url = $s_url }} {{ end }} + {{ end }} + {{ if $url }} {{ break }} {{ end }} + {{ end }} +{{ end }} +{{ if $url }} + + {{ if .Get "showIcon" }}{{ partial "icon.html" $name }} {{ end }} + {{ .Inner | markdownify }} + +{{ else }} + {{ errorf "Sociallink shortcode: link not found" $name }} +{{ end }}