How to link replies on the replies page to their original context

I recently included my replies as a page on my website. I would like for readers to be able to find and see the context in which each reply was written. How can I link back to the original post that I was replying too? Maybe something like this:

Or this:

2 Likes

You mean like this? It’s a built-in feature of Tiny Theme if you’re interested in it. Others have done it on other themes as well.

Here’s an example way to manually add it in your custom theme in section/replies.html.

{{ if .Params.reply_to_url }}
<div class="reply-to">
Replying to: {{ if eq .Params.reply_to_hostname "micro.blog" }} <a href="{{ .Params.reply_to_url }}" class="u-in-reply-to">@{{ .Params.reply_to_username }}</a>
{{ else }}
<a href="{{ .Params.reply_to_url }}" class="u-in-reply-to">{{ .Params.reply_to_hostname }}</a>
{{ end }}
</div>
{{ end }}
2 Likes

Exactly. I noticed the change in the recent theme update. Thanks for the extra instructions.

inside section/replies.html Is there a particular part of the template where this should be added ?

I’m using the Card theme GitHub - ericgregorich/micro-blog-cards-theme: Cards is a simple theme for Micro.blog.

Just seeing this. It’s basically where you want it to show. I recommend in the byline.

For what it’s worth, I made a change to this code on my Replies page that I like.

I was dissatisfied with replies to Mastodon users only showing their hostname (mastodon.social, social.lol, etc.) and not their usernames. So I removed the if/else statement and used the {{ .Params.reply_to_username }} bit for every reply, not just replies to Micro.blog users.

Here’s the new code:

<!-- REPLYING TO LINK -->
{{ if .Params.reply_to_url }}
<div class="reply_to">
	Replying to: <img src="{{ .Params.reply_to_avatar }}" width="22" height="22" style="width: 22px; height: 22px; vertical-align: top; border-radius: 11px; padding: 0px; display: inline;" alt="{{ .Params.reply_to_username }}" />
<a href="{{ .Params.reply_to_url }}" class="u-in-reply-to">@{{ .Params.reply_to_username }}</a>
  </div>
{{ end }}

(Note that my implementation includes the avatar image for the user I’m replying to.)

Before:

And after:

In my opinion, this makes it way more clear who I’m replying to. And it has the added benefit of fixing the username of replies to my own posts, which were showing the hostname instead of my username even though they’re through Micro.blog. :man_shrugging:

Maybe this will cause problems if I’m replying to a regular blog post instead of an ActivityPub post, but I haven’t seen any issues yet.