Locations Plugin

Overriding this seems a bit extreme, why not use connectors?:

topic-list-after-title OR

Take a look at An interesting strategy for passing properties via raw template plugin outlets


Because I didn’t find the right ones (or maybe they didn’t exist at the time I modified the template, about 2 years ago) :sweat_smile:

Will probably be easier this way, I’ll give it a try, thanks!

Uh… Can’t achieve to use these connectors.

Boring stuff I've tried and looked at

I’ve read Developer’s guide to Discourse Themes.

Assuming this is how we add HTML code in a connector:

<script type="text/x-handlebars" data-template-name="/connectors/topic-above-post-stream/test">
  <div style="height: 200px; width: 200px;background: red"></div>

I tried

<script type="text/x-handlebars" data-template-name="/connectors/topic-list-after-title/test">
  <div style="height: 200px; width: 200px;background: red"></div>

But it didn’t work. Is that because topic-list-item is a .hbr and not a .hbs file?

I used Plugin outlet locations theme component but the outlets inside the topic list don’t show up.

I also looked at this What is the difference between raw.hbs handlerbar files and only .hbs handlerbar files?.

Or maybe I just need to create a theme component with an additional file, like this https://github.com/discourse/discourse-topic-thumbnails/blob/main/javascripts/discourse/connectors/topic-list-before-link/topic-thumbnail.hbr?

But here, new connectors are created, while topic-list-after-title and topic-list-before-category already exist… So I’m a bit puzzled here.


Maybe this helps?:




or even better:

{{location-format context.topic.location}}

which leads to:

which you can then refine with CSS (eg move to new line).


Yup, perfect, thanks a lot Robert!

So, for those who are interested, this theme component simply adds the locations to the topic list.


Using the outlet is way more elegant, but there is an issue.

The outlet location is just after the topic title… And before the badges div (where it shows the dot indicating unread messages or new topics). The result:


I see no easy solution to fix this, even with CSS (I tried stuff).

I also feel that asking for a new outlet in #feature wouldn’t be interesting enough to be added to Discourse.

Edit: I made it so the badge is next to the location. That will do.


1 Like

@Canapin once this is mature I’d definitely welcome this as a PR to the main plugin repo so long as:

  • the behaviour was behind a plugin setting

  • the CSS designed in such a way that it doesn’t disturb things if there are other uses of the outlet in addition to this one.

    For example, Topic Ratings also uses the same plugin outlet. Turns out you can chain things via the same outlet. I tested this and it appears they both show if active at the same time (good :+1: ), but you wouldn’t want the CSS to disturb the ratings section unnecessarily.

  • ditto if the setting was OFF

  • Also, if the setting was OFF you’d want the icon to remain in its original position.


Any quick clue on how to add or remove CSS rules regarding a site setting? I don’t know how to do that. :see_no_evil:

I also add that images in the documentation links don’t work anymore:



I just updated Discourse (1b56a55f50) and our Locations Plugin is broken. When clicking a button related to the plugin, I get that:

everything is up-to-date, and it was working fine before updating. Please let me know how I can assist in fixing this :slight_smile:


Thanks for the report.

This is now fixed: FIX: Show Map button failure by merefield · Pull Request #69 · paviliondev/discourse-locations · GitHub


Thanks :slight_smile:

This fixes the map! But the other buttons are also broken: when clicking on “find address” when creating a discussion, and clicking the small location icon in a topic list shows the pin button instead.

Btw thank you for this plugin, it’s so convenient.


Ah, sorry, there were more. My quick text search didn’t pick them up.

For now I’ve additionally fixed: FIX: Find Address button not functioning by merefield · Pull Request #70 · paviliondev/discourse-locations · GitHub

You might have to wait a little while for the other one.


Hi folks - I’m interested in adding a State/City field to my new user sign up process, which would then populate the locations map. Is there an easy way to accomplish this? Thanks!


I am having the exact same problem. Can someone help @dodesz and me? :slight_smile: Thank you!

I have another question. When I try to add a location to a new post and click “Save”, the window does not close anymore. In the developer console of the browser I see everytime I hit “Save” the following:

Deprecation notice: DButton no longer supports @action as a string. Please refactor to use an closure action instead. [deprecation id: discourse.d-button-action-string]

User problem or maybe problem with another plugin or component or just a bug?

1 Like

Must be due to a core change as it is also happening on the Events plugin:

1 Like

This PR is in progress, I’ll let you know when it’s done.


PR merged, let me know if you encounter any issues



Thank you, it works now :slight_smile:


We’ve actually merged a second tranche of fixes and updates, please update the plugin.


Thank you for this :slight_smile:

It’s minor, but I still see this bug:

When clicking on the location icon on a list of topics, the pinned icon appears, instead of going to the first post in the topic.

1 Like