The feedback email address seems to be getting traction and I’m getting more mail every week.
I wanted to make it easier on myself and for the kind folks who write in, by including the title of the post in the subject of the email.
Right now, every one tells me what post they are talking about, which as I said in exceedingly kind of the folks who write in. My posts seem to be reaching really considerate people :)
So a teensy bit of head-scratching later, I remembered I use shortcodes to inject custom HTML into my pages. I remembered Hugo has variables I could access. And I remembered mailto
links let me add a subject parameter to the link.
So, 1+2+3=Sucess! (Or so I hoped)
The How
- I looked up the variable, I needed to get at the post’s title. It’s called
.Page.Title
- I created a
hpt.html
in my Hugo’slayouts/shortcodes
directory to hold the little snippet that’d get typed in the email’s subject field. This is all it contains:Feedback on post: {{ .Page.Title }}
Hugo will grab this snippet whenever it runs and put in the post’s title in place of the placeholder. - And then I can use that in a
mailto
link like so,[feedback at this domain](dummyemail@dummydomain.local?subject="{{< hpt >}}")
1
And tada! 1+2+3 does indeed equal success! You can see in action, by clicking on the link below to send me feedback 🙂
Feedback on this post? Mail me at feedback at this domain
P.S. Subscribe to my mailing list!
Forward these posts and letters to your friends and get them to subscribe!
P.P.S. Feed my insatiable reading habit.
This is a markdown formatted link. You can ofcourse use HTML ↩︎