Add badge and button shortcodes

pull/2/head
James Panther 2021-08-16 15:09:21 +10:00
parent 7ce10997ce
commit fe7d59a855
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
6 changed files with 18 additions and 9 deletions

View File

@ -3,7 +3,7 @@
xmlns:xhtml="http://www.w3.org/1999/xhtml"> xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }} {{ range .Data.Pages }}
{{ if not (in .Site.Params.sitemap.excludedKinds .Kind) }} {{ if not (in .Site.Params.sitemap.excludedKinds .Kind) }}
{{ if and (.Param "xml" | default true) (not (isset .Params "externalurl")) }} {{ if and (.Param "xml" | default true) (not (isset .Params "externalUrl")) }}
{{- if .Permalink -}} {{- if .Permalink -}}
<url> <url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}

View File

@ -1,7 +1,7 @@
<article> <article>
<h3 class="mt-6 text-xl font-semibold"> <h3 class="mt-6 text-xl font-semibold">
{{ if isset .Params "externalurl" }} {{ if isset .Params "externalUrl" }}
<a class="hover:underline" href="{{ .Params.externalurl }}" target="_blank" rel="external" <a class="hover:underline" href="{{ .Params.externalUrl }}" target="_blank" rel="external"
>{{ .Title }}</a >{{ .Title }}</a
> >
<span <span
@ -14,11 +14,7 @@
<a class="hover:underline" href="{{ .Permalink }}">{{ .Title }}</a> <a class="hover:underline" href="{{ .Permalink }}">{{ .Title }}</a>
{{ end }} {{ end }}
{{ if and .Draft .Site.Params.article.showDraftLabel }} {{ if and .Draft .Site.Params.article.showDraftLabel }}
<span {{ partial "badge.html" "Draft" }}
class="ml-1 px-1 py-[2px] text-xs font-normal border rounded-md text-primary-700 dark:text-primary-400 border-primary-400 dark:border-primary-600 inline-block align-middle mb-1"
>
Draft
</span>
{{ end }} {{ end }}
{{ if templates.Exists "partials/extend-article-link.html" }} {{ if templates.Exists "partials/extend-article-link.html" }}
{{ partial "extend-article-link.html" . }} {{ partial "extend-article-link.html" . }}

View File

@ -0,0 +1,5 @@
<span
class="ml-1 px-1 py-[2px] text-xs font-normal border rounded-md text-primary-700 dark:text-primary-400 border-primary-400 dark:border-primary-600 inline-block align-middle mb-1"
>
{{ . }}
</span>

View File

@ -0,0 +1 @@
{{ partial "badge.html" .Inner }}

View File

@ -0,0 +1,7 @@
<a
class="px-4 py-2 !text-white !no-underline rounded-md bg-primary-600 hover:!bg-primary-500 dark:bg-primary-800 dark:hover:!bg-primary-700"
{{ with .Get "href" }}href="{{ . }}"{{ end }}
{{ with .Get "target" }}target="{{ . }}"{{ end }}
role="button"
>{{ .Inner }}
</a>

File diff suppressed because one or more lines are too long