Willy
(Willy)
June 13, 2025, 5:29pm
1
If my component is installed on three different forums:
https://forum.someone.com/
https://other.com/forum
https://player.com/
How do I extract the base URI if I’m in a subdirectory like https://forum.someone.com/mytopic/blablaba
?
Lilly
June 13, 2025, 5:33pm
2
i think perhaps you may be looking for this feature, which is not merged yet
Once this PR is merged, you’ll be able to use %{base_path} in theme setting descriptions:
2 Likes
Moin
June 13, 2025, 8:59pm
3
Where do you want to use it?
The Reddit-ish theme, for example, uses discourse/helpers/base-path
in the template to create the “the category list” link in the welcome message on the right.
tags: this.args.tag?.id,
});
}
<template>
{{#if this.isTopRoute}}
<div class="custom-right-sidebar_welcome">
<h2>{{i18n (themePrefix "top_route_welcome")}}</h2>
<p>
{{htmlSafe
(i18n (themePrefix "top_route_description") basePath=(basePath))
}}
</p>
{{#if (and this.currentUser this.currentUser.can_create_topic)}}
<DButton
class="btn-primary"
@id="custom-create-topic"
@action={{action "customCreateTopic"}}
@label="topic.create"
/>
{{/if}}
There are also examples where discourse/lib/get-url
is used to get the URL in a JavaScript function.
5 Likes