├── LICENSE
├── README.md
├── config.json
├── content
└── reply-by-email.md
├── docs
├── screenshots.png
└── styling-example.png
├── layouts
└── partials
│ ├── rbe-obfuscate.html
│ ├── reply-by-email-head.html
│ └── reply-by-email.html
└── plugin.json
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Sven Dahlstrand
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ✍️ Reply by email for Micro.blog
2 |
3 | Let readers reply to your blog posts using their default email app.
4 |
5 | 
6 |
7 | > Your blog posts get a **Reply by email** link with this nifty plug-in. The reader's default email app opens in compose view when they tap that link; your email address and a subject line are already filled in.
8 |
9 | To get updates on this plug-in, [follow @sod on Micro.blog](https://micro.blog/sod).
10 |
11 | ## Do you get value from Reply by email? I'd love your support!
12 |
13 | Hey! It's me, Sven. Reply by email and my other plug-ins are passion projects released to the world for free. That said, donations are always welcome if you get value from my work.
14 |
15 | [💸 Donate $10](https://dahlstrand.net/donate/) or any amount you're comfortable with. Thanks! 🙏
16 |
17 | ## Bells and whistles
18 |
19 | * 🛠 Customizable via plug-in settings.
20 | * ✍️ Change the link text to whatever you want. Go bananas! Use emojis!
21 | * ⛳️ Flexible placement in your theme using a Hugo partial.
22 | * 💌 Subject line is automatically set to the blog post title (or post excerpt, if no title is present).
23 | * 🏷 Optionally prefix the subject line with *Reply to* or whatever you want.
24 | * 🎁 Customize the look and feel using CSS.
25 |
26 | ## Get started
27 |
28 | Hello, fellow microblogger! 👋 Thanks for being here. This plug-in is available in the official directory, so the installation process is quick and easy.
29 |
30 | ### Install the plug-in
31 |
32 | 1. Find [Reply by email in the plug-in directory](https://micro.blog/account/plugins/view/23).
33 | 2. Choose the site you want to install the plug-in to.
34 | 3. Press *Install*.
35 | 4. Congratulations, the plug-in is now installed. On to configuration.
36 |
37 | ### Configure the plug-in
38 |
39 | 1. Go to *Plug-ins* and press ⚙️ *Settings* (next to the Reply by email plug-in).
40 |
41 | 2. Enter your address in *Reply by email*.
42 |
43 | 3. Make other changes as you see fit.
44 |
45 | 4. Press *Update Settings* and go to the next step.
46 |
47 | ### Include the Reply by email link in your theme
48 |
49 | Some themes, like Hitchens and Tiny, come with built-in support for this plug-in. If you're on such a theme, skip this step and continue to *Make sure the Reply by email link show up*.
50 |
51 | If your current theme lacks built-in support, you need a custom theme. Maybe you already have one? If not, [follow Manton's instructions here](https://help.micro.blog/t/custom-themes/59).
52 |
53 | 1. [Follow this link](https://micro.blog/account/themes) or go to *Design* → *Edit Custom Themes*.
54 |
55 | 2. Click on your custom theme. (It's probably named Marfa Custom or something like that.)
56 |
57 | 3. Click on the template `layouts/post/single.html`
58 |
59 | 4. Add this partial call where you see fit: `{{ partial "reply-by-email.html" . }}`. A good place is after the content (look for `{{ .Content }}` in the template).
60 |
61 | 5. Press *Update Template* and pat yourself on the back.
62 |
63 | ### Make sure the Reply by email link show up
64 |
65 | 1. Find a post on your blog and make sure you see the *Reply by email* link.
66 |
67 | 2. Click it, make sure it works like expected.
68 |
69 | ### Customize the look and feel
70 |
71 | The *Reply by email* link is delivered to you with minimal markup and styles. Every Micro.blog theme is individual, and this bare-bones approach keeps it flexible. It's up to you to implement a custom look and feel using HTML and CSS. Here's a couple of examples for your inspiration.
72 |
73 | #### Give the link breathing room with a paragraph
74 |
75 | There's an easy way to add a space between the *Reply by email* link and content around it. Just wrap the link in a paragraph. Add the partial call to the template in this way:
76 |
77 | ```html
78 |
{{ partial "reply-by-email.html" . }}
79 | ```
80 |
81 | That should result in the same amount of breathing space text paragraphs have between them.
82 |
83 | #### Be creative with emoji and HTML
84 |
85 | On the plug-in ⚙️ *Settings* page, you can customize the link text. The default *Reply by email* can be changed to anything you want. You can even use emoji and HTML!
86 |
87 | If you install [the Font Awesome plug-in](https://micro.blog/account/plugins/view/74) you'll get plenty of additional icons to use. Do you want a fancy paper plane next to your text? Save your link text like this:
88 |
89 | ```html
90 | Reply by email
91 | ```
92 |
93 | #### Flexible look and hover effect using CSS
94 |
95 | If you're comfortable with CSS, there are endless possibilities for styling. And if you're new to CSS, you can still do it! You can learn a lot from [@Miraz](http://micro.blog/miraz)'s excellent tutorials. Start with [What you need to know about CSS to customise your Micro.Blog blog](https://custom.micro.blog/2019/06/04/what-you-need.html).
96 |
97 | The *Reply by email* link is just an `a` element with the class `reply-by-email`. I experimented with the CSS below to get a nice hover effect. It's not guaranteed to look good on your blog, though. 😉
98 |
99 |
100 |
101 | To add custom CSS to a Micro.blog, navigate to *Design* → *Edit CSS*.
102 |
103 | ```css
104 | .reply-by-email {
105 | border: solid 0.15rem black;
106 | border-radius: 0.4rem;
107 | color: black;
108 | display: inline-block;
109 | font-weight: bold;
110 | padding: 0.3rem 0.6rem 0 0.6rem;
111 | text-decoration: none;
112 | }
113 |
114 | .reply-by-email:hover {
115 | border-color: #011ac5;
116 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
117 | color: #011ac5;
118 | text-decoration: none;
119 | }
120 | ```
121 |
122 | ### Having troubles?
123 |
124 | Feel free to [reach out to @sod on Micro.blog](https://micro.blog/sod) for additional help.
125 |
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "params": {
3 | "reply_by_email_link_text": "✍️ Reply by email",
4 | "reply_by_email_subject_prefix": "Re: ",
5 | "reply_by_email_show_title": true,
6 | "reply_by_email_show_plain": true,
7 | "reply_by_email_enable_obfuscation": true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/content/reply-by-email.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Email Protection 🛡️
3 | url: /reply-by-email/
4 | ---
5 |
6 | To reply by email, you must enable JavaScript in your browser.
7 |
8 | This is a measure to mitigate spam and discourage automated bots from harvesting email addresses. Sorry for the inconvenience.
9 |
--------------------------------------------------------------------------------
/docs/screenshots.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/svendahlstrand/plugin-reply-by-email/cc0d7540692bdf8609c73e506e80d45ae25a9d3c/docs/screenshots.png
--------------------------------------------------------------------------------
/docs/styling-example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/svendahlstrand/plugin-reply-by-email/cc0d7540692bdf8609c73e506e80d45ae25a9d3c/docs/styling-example.png
--------------------------------------------------------------------------------
/layouts/partials/rbe-obfuscate.html:
--------------------------------------------------------------------------------
1 | {{- $hexadecimal := (replace (. | urlquery) "+" "%20") | base64Encode -}}
2 | {{- $hexadecimal = replace $hexadecimal "A" "A," -}}
3 | {{- $hexadecimal = replace $hexadecimal "B" "B," -}}
4 | {{- $hexadecimal = replace $hexadecimal "C" "C," -}}
5 | {{- $hexadecimal = replace $hexadecimal "D" "D," -}}
6 | {{- $hexadecimal = replace $hexadecimal "E" "E," -}}
7 | {{- $hexadecimal = replace $hexadecimal "F" "F," -}}
8 | {{- $hexadecimal = replace $hexadecimal "G" "G," -}}
9 | {{- $hexadecimal = replace $hexadecimal "H" "H," -}}
10 | {{- $hexadecimal = replace $hexadecimal "I" "I," -}}
11 | {{- $hexadecimal = replace $hexadecimal "J" "J," -}}
12 | {{- $hexadecimal = replace $hexadecimal "K" "K," -}}
13 | {{- $hexadecimal = replace $hexadecimal "L" "L," -}}
14 | {{- $hexadecimal = replace $hexadecimal "M" "M," -}}
15 | {{- $hexadecimal = replace $hexadecimal "N" "N," -}}
16 | {{- $hexadecimal = replace $hexadecimal "O" "O," -}}
17 | {{- $hexadecimal = replace $hexadecimal "P" "P," -}}
18 | {{- $hexadecimal = replace $hexadecimal "Q" "Q," -}}
19 | {{- $hexadecimal = replace $hexadecimal "R" "R," -}}
20 | {{- $hexadecimal = replace $hexadecimal "S" "S," -}}
21 | {{- $hexadecimal = replace $hexadecimal "T" "T," -}}
22 | {{- $hexadecimal = replace $hexadecimal "U" "U," -}}
23 | {{- $hexadecimal = replace $hexadecimal "V" "V," -}}
24 | {{- $hexadecimal = replace $hexadecimal "W" "W," -}}
25 | {{- $hexadecimal = replace $hexadecimal "X" "X," -}}
26 | {{- $hexadecimal = replace $hexadecimal "Y" "Y," -}}
27 | {{- $hexadecimal = replace $hexadecimal "Z" "Z," -}}
28 | {{- $hexadecimal = replace $hexadecimal "a" "a," -}}
29 | {{- $hexadecimal = replace $hexadecimal "b" "b," -}}
30 | {{- $hexadecimal = replace $hexadecimal "c" "c," -}}
31 | {{- $hexadecimal = replace $hexadecimal "d" "d," -}}
32 | {{- $hexadecimal = replace $hexadecimal "e" "e," -}}
33 | {{- $hexadecimal = replace $hexadecimal "f" "f," -}}
34 | {{- $hexadecimal = replace $hexadecimal "g" "g," -}}
35 | {{- $hexadecimal = replace $hexadecimal "h" "h," -}}
36 | {{- $hexadecimal = replace $hexadecimal "i" "i," -}}
37 | {{- $hexadecimal = replace $hexadecimal "j" "j," -}}
38 | {{- $hexadecimal = replace $hexadecimal "k" "k," -}}
39 | {{- $hexadecimal = replace $hexadecimal "l" "l," -}}
40 | {{- $hexadecimal = replace $hexadecimal "m" "m," -}}
41 | {{- $hexadecimal = replace $hexadecimal "n" "n," -}}
42 | {{- $hexadecimal = replace $hexadecimal "o" "o," -}}
43 | {{- $hexadecimal = replace $hexadecimal "p" "p," -}}
44 | {{- $hexadecimal = replace $hexadecimal "q" "q," -}}
45 | {{- $hexadecimal = replace $hexadecimal "r" "r," -}}
46 | {{- $hexadecimal = replace $hexadecimal "s" "s," -}}
47 | {{- $hexadecimal = replace $hexadecimal "t" "t," -}}
48 | {{- $hexadecimal = replace $hexadecimal "u" "u," -}}
49 | {{- $hexadecimal = replace $hexadecimal "v" "v," -}}
50 | {{- $hexadecimal = replace $hexadecimal "w" "w," -}}
51 | {{- $hexadecimal = replace $hexadecimal "x" "x," -}}
52 | {{- $hexadecimal = replace $hexadecimal "y" "y," -}}
53 | {{- $hexadecimal = replace $hexadecimal "z" "z," -}}
54 | {{- $hexadecimal = replace $hexadecimal "0" "0," -}}
55 | {{- $hexadecimal = replace $hexadecimal "1" "1," -}}
56 | {{- $hexadecimal = replace $hexadecimal "2" "2," -}}
57 | {{- $hexadecimal = replace $hexadecimal "3" "3," -}}
58 | {{- $hexadecimal = replace $hexadecimal "4" "4," -}}
59 | {{- $hexadecimal = replace $hexadecimal "5" "5," -}}
60 | {{- $hexadecimal = replace $hexadecimal "6" "6," -}}
61 | {{- $hexadecimal = replace $hexadecimal "7" "7," -}}
62 | {{- $hexadecimal = replace $hexadecimal "8" "8," -}}
63 | {{- $hexadecimal = replace $hexadecimal "9" "9," -}}
64 | {{- $hexadecimal = replace $hexadecimal "+" "+," -}}
65 | {{- $hexadecimal = replace $hexadecimal "/" "/," -}}
66 | {{- $hexadecimal = replace $hexadecimal "=" "=," -}}
67 | {{- $hexadecimal = replace $hexadecimal "A," "65" -}}
68 | {{- $hexadecimal = replace $hexadecimal "B," "66" -}}
69 | {{- $hexadecimal = replace $hexadecimal "C," "67" -}}
70 | {{- $hexadecimal = replace $hexadecimal "D," "60" -}}
71 | {{- $hexadecimal = replace $hexadecimal "E," "61" -}}
72 | {{- $hexadecimal = replace $hexadecimal "F," "62" -}}
73 | {{- $hexadecimal = replace $hexadecimal "G," "63" -}}
74 | {{- $hexadecimal = replace $hexadecimal "H," "6c" -}}
75 | {{- $hexadecimal = replace $hexadecimal "I," "6d" -}}
76 | {{- $hexadecimal = replace $hexadecimal "J," "6e" -}}
77 | {{- $hexadecimal = replace $hexadecimal "K," "6f" -}}
78 | {{- $hexadecimal = replace $hexadecimal "L," "68" -}}
79 | {{- $hexadecimal = replace $hexadecimal "M," "69" -}}
80 | {{- $hexadecimal = replace $hexadecimal "N," "6a" -}}
81 | {{- $hexadecimal = replace $hexadecimal "O," "6b" -}}
82 | {{- $hexadecimal = replace $hexadecimal "P," "74" -}}
83 | {{- $hexadecimal = replace $hexadecimal "Q," "75" -}}
84 | {{- $hexadecimal = replace $hexadecimal "R," "76" -}}
85 | {{- $hexadecimal = replace $hexadecimal "S," "77" -}}
86 | {{- $hexadecimal = replace $hexadecimal "T," "70" -}}
87 | {{- $hexadecimal = replace $hexadecimal "U," "71" -}}
88 | {{- $hexadecimal = replace $hexadecimal "V," "72" -}}
89 | {{- $hexadecimal = replace $hexadecimal "W," "73" -}}
90 | {{- $hexadecimal = replace $hexadecimal "X," "7c" -}}
91 | {{- $hexadecimal = replace $hexadecimal "Y," "7d" -}}
92 | {{- $hexadecimal = replace $hexadecimal "Z," "7e" -}}
93 | {{- $hexadecimal = replace $hexadecimal "a," "45" -}}
94 | {{- $hexadecimal = replace $hexadecimal "b," "46" -}}
95 | {{- $hexadecimal = replace $hexadecimal "c," "47" -}}
96 | {{- $hexadecimal = replace $hexadecimal "d," "40" -}}
97 | {{- $hexadecimal = replace $hexadecimal "e," "41" -}}
98 | {{- $hexadecimal = replace $hexadecimal "f," "42" -}}
99 | {{- $hexadecimal = replace $hexadecimal "g," "43" -}}
100 | {{- $hexadecimal = replace $hexadecimal "h," "4c" -}}
101 | {{- $hexadecimal = replace $hexadecimal "i," "4d" -}}
102 | {{- $hexadecimal = replace $hexadecimal "j," "4e" -}}
103 | {{- $hexadecimal = replace $hexadecimal "k," "4f" -}}
104 | {{- $hexadecimal = replace $hexadecimal "l," "48" -}}
105 | {{- $hexadecimal = replace $hexadecimal "m," "49" -}}
106 | {{- $hexadecimal = replace $hexadecimal "n," "4a" -}}
107 | {{- $hexadecimal = replace $hexadecimal "o," "4b" -}}
108 | {{- $hexadecimal = replace $hexadecimal "p," "54" -}}
109 | {{- $hexadecimal = replace $hexadecimal "q," "55" -}}
110 | {{- $hexadecimal = replace $hexadecimal "r," "56" -}}
111 | {{- $hexadecimal = replace $hexadecimal "s," "57" -}}
112 | {{- $hexadecimal = replace $hexadecimal "t," "50" -}}
113 | {{- $hexadecimal = replace $hexadecimal "u," "51" -}}
114 | {{- $hexadecimal = replace $hexadecimal "v," "52" -}}
115 | {{- $hexadecimal = replace $hexadecimal "w," "53" -}}
116 | {{- $hexadecimal = replace $hexadecimal "x," "5c" -}}
117 | {{- $hexadecimal = replace $hexadecimal "y," "5d" -}}
118 | {{- $hexadecimal = replace $hexadecimal "z," "5e" -}}
119 | {{- $hexadecimal = replace $hexadecimal "0," "14" -}}
120 | {{- $hexadecimal = replace $hexadecimal "1," "15" -}}
121 | {{- $hexadecimal = replace $hexadecimal "2," "16" -}}
122 | {{- $hexadecimal = replace $hexadecimal "3," "17" -}}
123 | {{- $hexadecimal = replace $hexadecimal "4," "10" -}}
124 | {{- $hexadecimal = replace $hexadecimal "5," "11" -}}
125 | {{- $hexadecimal = replace $hexadecimal "6," "12" -}}
126 | {{- $hexadecimal = replace $hexadecimal "7," "13" -}}
127 | {{- $hexadecimal = replace $hexadecimal "8," "1c" -}}
128 | {{- $hexadecimal = replace $hexadecimal "9," "1d" -}}
129 | {{- $hexadecimal = replace $hexadecimal "+," "0f" -}}
130 | {{- $hexadecimal = replace $hexadecimal "/," "0b" -}}
131 | {{- $hexadecimal = replace $hexadecimal "=," "19" -}}
132 | {{- $hexadecimal -}}
--------------------------------------------------------------------------------
/layouts/partials/reply-by-email-head.html:
--------------------------------------------------------------------------------
1 | {{ $email_address := $.Site.Params.reply_by_email_address }}
2 | {{ $email_address_present := in $email_address "@" }}
3 | {{- $enable_obfuscation := $.Site.Params.reply_by_email_enable_obfuscation -}}
4 | {{- if eq .RelPermalink "/reply-by-email/" -}}
5 |
6 | {{- end -}}
7 | {{- if and $enable_obfuscation $email_address_present -}}
8 |
20 | {{- end -}}
21 |
--------------------------------------------------------------------------------
/layouts/partials/reply-by-email.html:
--------------------------------------------------------------------------------
1 | {{ $link_text := or $.Site.Params.reply_by_email_link_text "Reply by email" }}
2 | {{ $show_title := $.Site.Params.reply_by_email_show_title }}
3 | {{ $show_plain := $.Site.Params.reply_by_email_show_plain }}
4 | {{ $email_address := $.Site.Params.reply_by_email_address }}
5 | {{ $email_address_present := in $email_address "@" }}
6 | {{ $subject := $.Site.Params.reply_by_email_subject_prefix }}
7 | {{ $enable_obfuscation := $.Site.Params.reply_by_email_enable_obfuscation }}
8 |
9 | {{ if (and .Title $show_title) }}
10 | {{ $subject = print $subject .Title }}
11 | {{ else if (and (not .Title) .Plain $show_plain) }}
12 | {{ $subject = (print $subject (replaceRE "(\\s)" " " .Plain)) | htmlUnescape | truncate 60 }}
13 | {{ else }}
14 | {{ $subject = print $subject .Permalink }}
15 | {{ end }}
16 |
17 | {{ if and $enable_obfuscation $email_address_present }}
18 | {{ $link_text | safeHTML }}
19 | {{ else if $email_address_present }}
20 | {{ $link_text | safeHTML }}
21 | {{ else }}
22 | {{ $link_text | safeHTML }}
23 | This blog's owner has not provided a valid email address yet.
24 | {{ end }}
25 |
--------------------------------------------------------------------------------
/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.3.0",
3 | "title": "Reply by email",
4 | "description": "Let readers reply to your blog posts using their default email app.",
5 | "fields": [
6 | {
7 | "field": "params.reply_by_email_address",
8 | "label": "Reply by email",
9 | "placeholder": "ada@lovelace.co.uk"
10 | },
11 | {
12 | "field": "params.reply_by_email_link_text",
13 | "label": "Link text",
14 | "placeholder": "Reply by email"
15 | },
16 | {
17 | "field": "params.reply_by_email_subject_prefix",
18 | "label": "Subject line prefix",
19 | "placeholder": "Re: "
20 | },
21 | {
22 | "field": "params.reply_by_email_show_title",
23 | "label": "Show title in subject line",
24 | "type": "boolean"
25 | },
26 | {
27 | "field": "params.reply_by_email_show_plain",
28 | "label": "Show body in subject line (when title is missing)",
29 | "type": "boolean"
30 | },
31 | {
32 | "field": "params.reply_by_email_enable_obfuscation",
33 | "label": "Obfuscate email address (to mitigate scraping)",
34 | "type": "boolean"
35 | }
36 | ],
37 | "includes": [
38 | "reply-by-email-head.html"
39 | ]
40 | }
41 |
--------------------------------------------------------------------------------