How do I create a custom theme to show location data?

Hello friends,

I’m trying to show my location information when I check into Swarm. I’ve got Own Your Swarm connected and it posts to my timeline when I check in, there’s just no location data associated with it and I’d like there to be.

Looking at the current documentation on how to do this, it says that I need to create a custom theme to show location data. Can anyone walk me through how to do this? I’m unfortunately in an ELI5-type situation when it comes to this, so I’m going to need a lot of hand holding.

Thanks, y’all! Appreciate any help I can get with this!

:wave: Hello!

What you have to do is:

  1. Create a custom theme.

  2. Update the template layouts/post/single.html to include your location information.

How you want to present the location information in step 2 is up to you. Manton shared this snippet as a starting point:

{{ if .Params.location_latitude }}
  <img src="https://example-mapping-service.com/?center={{ .Params.location_latitude }},{{ .Params.location_longitude}}" />
{{ end }}

So, for example, if you want to link to your location on a map, you could do something like this:

{{ if .Params.location_latitude }}
  <a href="http://maps.apple.com/?ll={{ .Params.location_latitude }},{{ .Params.location_longitude}}&z=4">🗺 See this location on a map</a>
{{ end }}

You could also take a peek behind the curtain on others’ implementations, like this plug-in or this theme.

2 Likes

Thank you so much for replying! I don’t quite have this down, but I understand it way better than I did, so thank you for taking the time to reply. I really do appreciate it.

I think the issue may be that Own Your Swarm isn’t actually passing the location information. I see the text I’ve added (see screenshot below), but when I click on the “See this location on a map”, it opens Apple Maps, but doesn’t actually show the location.

Also oddly I don’t see the “See this location on a map” in the main timeline…

Regardless, I really do appreciate your help. I need to get a lot smarter on how to do the basics on this before continuing.

If you pass the URL to the post in your screenshot, I can take a look and see if I can figure out what’s going on.

Thank you, so much! And apologies for the delay in responding. I can’t tell you how much I appreciate your help here.

I very much like the idea of anything I do online taking at least a pass through my personal blog, but I need to be a bit more thoughtful about how I want things like Swarm (and letterboxd reviews!) to look and act before I take you up on your offer.

Thanks again!

Hi :grinning:

Very late to this, sorry, but I’ve had a leave of absence from micro.blog. However, you may be interested in:

and

Look on my micro.blog to see the second variant in action.