{{ stock }} shortcode for linking to a finance page for a stock ticker symbol
This commit is contained in:
parent
eb9d763638
commit
24871ecf49
1 changed files with 10 additions and 0 deletions
10
layouts/shortcodes/stock.html
Normal file
10
layouts/shortcodes/stock.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{{- $symbol := "" -}}
|
||||
{{- $text := "" -}}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{ $symbol = .Get "symbol" }}
|
||||
{{ $text = .Params.text | default (printf "$%s" $symbol) }}
|
||||
{{- else -}}
|
||||
{{ $symbol = .Get 0 }}
|
||||
{{ $text = printf "$%s" $symbol }}
|
||||
{{- end -}}
|
||||
<a href="https://finance.yahoo.com/quote/{{ $symbol }}">{{ $text }}</a>
|
Loading…
Add table
Add a link
Reference in a new issue