mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-05-20 20:11:53 +02:00
+sociallink shortcode
This commit is contained in:
parent
18ac12ea3c
commit
cf15d7c83d
2 changed files with 58 additions and 12 deletions
|
@ -339,7 +339,7 @@ In order to add images to the gallery, use `img` tags for each image and add `cl
|
||||||
|
|
||||||
## GitLab Card
|
## 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.
|
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.
|
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.
|
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.
|
When life gives you lemons, make lemonade.
|
||||||
{{< /lead >}}
|
{{< /lead >}}
|
||||||
|
|
||||||
<br/><br/><br/>
|
<br/><br/><br/>
|
||||||
|
|
||||||
## List
|
## List
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ The `where` and `value` values are used in the following query `where .Site.Regu
|
||||||
|
|
||||||
<br/><br/><br/>
|
<br/><br/><br/>
|
||||||
|
|
||||||
## 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.
|
`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
|
||||||
|
|
||||||
<br/><br/><br/>
|
<br/><br/><br/>
|
||||||
|
|
||||||
|
## Social Link
|
||||||
|
|
||||||
|
`sociallink` creates an anchor link for author socials from the config file, using the name param.
|
||||||
|
|
||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
| 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 |
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
|
||||||
|
```md
|
||||||
|
{{</* sociallink name="github" showIcon=true */>}}Github{{</* /sociallink */>}}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Output**
|
||||||
|
{{< sociallink name="github" showIcon=true >}}Github{{< /sociallink >}}
|
||||||
|
|
||||||
|
<br/><br/><br/>
|
||||||
|
|
||||||
## Swatches
|
## 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.
|
`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
|
||||||
{{</* timeline */>}}
|
{{</* timeline */>}}
|
||||||
|
|
||||||
{{</* timelineItem icon="github" header="header" badge="badge test" subheader="subheader" */>}}
|
{{</* 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.
|
||||||
{{</* /timelineItem */>}}
|
{{</* /timelineItem */>}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -650,7 +672,7 @@ With other shortcodes
|
||||||
{{< timeline >}}
|
{{< timeline >}}
|
||||||
|
|
||||||
{{< timelineItem icon="github" header="header" badge="badge test" subheader="subheader" >}}
|
{{< 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.
|
||||||
{{</ timelineItem >}}
|
{{</ timelineItem >}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -708,7 +730,7 @@ Blowfish implements a sub-set of TypeIt features using a `shortcode`. Write your
|
||||||
|
|
||||||
```md
|
```md
|
||||||
{{</* typeit */>}}
|
{{</* typeit */>}}
|
||||||
Lorem ipsum dolor sit amet
|
Lorem ipsum dolor sit amet
|
||||||
{{</* /typeit */>}}
|
{{</* /typeit */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -719,12 +741,12 @@ Lorem ipsum dolor sit amet
|
||||||
**Example 2:**
|
**Example 2:**
|
||||||
|
|
||||||
```md
|
```md
|
||||||
{{</* typeit
|
{{</* typeit
|
||||||
tag=h1
|
tag=h1
|
||||||
lifeLike=true
|
lifeLike=true
|
||||||
*/>}}
|
*/>}}
|
||||||
Lorem ipsum dolor sit amet,
|
Lorem ipsum dolor sit amet,
|
||||||
consectetur adipiscing elit.
|
consectetur adipiscing elit.
|
||||||
{{</* /typeit */>}}
|
{{</* /typeit */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -739,14 +761,14 @@ consectetur adipiscing elit.
|
||||||
**Example 3:**
|
**Example 3:**
|
||||||
|
|
||||||
```md
|
```md
|
||||||
{{</* typeit
|
{{</* typeit
|
||||||
tag=h3
|
tag=h3
|
||||||
speed=50
|
speed=50
|
||||||
breakLines=false
|
breakLines=false
|
||||||
loop=true
|
loop=true
|
||||||
*/>}}
|
*/>}}
|
||||||
Lorem ipsum dolor sit amet,
|
Lorem ipsum dolor sit amet,
|
||||||
consectetur adipiscing elit.
|
consectetur adipiscing elit.
|
||||||
{{</* /typeit */>}}
|
{{</* /typeit */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
24
layouts/shortcodes/sociallink.html
Normal file
24
layouts/shortcodes/sociallink.html
Normal file
|
@ -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 }}
|
||||||
|
<a
|
||||||
|
href="{{ $url | safeURL }}"
|
||||||
|
target="_blank"
|
||||||
|
aria-label="{{ $name | title }}"
|
||||||
|
rel="me noopener noreferrer"
|
||||||
|
>
|
||||||
|
{{ if .Get "showIcon" }}<span class="inline-block" style="vertical-align:text-top;" >{{ partial "icon.html" $name }} </span>{{ end }}
|
||||||
|
{{ .Inner | markdownify }}
|
||||||
|
</a>
|
||||||
|
{{ else }}
|
||||||
|
{{ errorf "Sociallink shortcode: link not found" $name }}
|
||||||
|
{{ end }}
|
Loading…
Add table
Reference in a new issue