diff --git a/README.md b/README.md index 5e117d58..a91cfeaf 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ It's a versatile canvas that serves most web needs. - Comments - Customizable - Dark color scheme -- E-mail protection +- Email shortcode - Facebook sharing - Figure shortcode - Gallery shortcode @@ -384,6 +384,27 @@ Parameters:
Optional. String. Hugo highlight options.
+### Email + +The `paige/email` shortcode hides e-mail addresses from robots. + +``` +{{< paige/email + address="" + text="" >}} +``` + +Inner content: None. + +Parameters: + +
+
address
+
Required. String. The e-mail address.
+
text
+
Required. String. The anchor text.
+
+ ### Figure The `paige/figure` shortcode provides a figure. diff --git a/exampleSite/content/shortcodes/email.md b/exampleSite/content/shortcodes/email.md new file mode 100644 index 00000000..63900033 --- /dev/null +++ b/exampleSite/content/shortcodes/email.md @@ -0,0 +1,23 @@ +--- +authors: ["will-faught"] +categories: ["paige", "shortcodes"] +description: "Demonstration of the Paige email shortcode." +tags: ["email"] +title: "Email Shortcode" +--- + +Paige provides a `paige/email` shortcode that hides e-mail addresses from robots. + + + +## Address and text parameters + +Code: + +```go-text-template +{{}} +``` + +Result: + +{{< paige/email address="example@example.com" text="E-mail me" >}} diff --git a/layouts/shortcodes/paige/email.html b/layouts/shortcodes/paige/email.html new file mode 100644 index 00000000..9adf63fd --- /dev/null +++ b/layouts/shortcodes/paige/email.html @@ -0,0 +1,12 @@ +{{ $address := .Get "address" }} +{{ $text := .Get "text" }} + +{{ if not $address }} + {{ errorf "layouts/shortcodes/paige/email.html: no address" }} +{{ end }} + +{{ if not $text }} + {{ errorf "layouts/shortcodes/paige/email.html: no text" }} +{{ end }} + +{{ $text }}