Willy
(Willy)
Junho 13, 2025, 5:29pm
1
Se meu componente estiver instalado em três fóruns diferentes:
https://forum.someone.com/
https://other.com/forum
https://player.com/
Como extraio a URI base se estiver em um subdiretório como https://forum.someone.com/mytopic/blablaba?
Lilly
Junho 13, 2025, 5:33pm
2
acho que talvez você esteja procurando por este recurso, que ainda não foi mesclado
Once this PR is merged, you’ll be able to use %{base_path} in theme setting descriptions:
Moin
Junho 13, 2025, 8:59pm
3
Onde você quer usá-lo?
O tema semelhante ao Reddit, por exemplo, usa discourse/helpers/base-path no template para criar o link “a lista de categorias” na mensagem de boas-vindas à direita.
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}}
Existem também exemplos onde discourse/lib/get-url é usado para obter a URL em uma função JavaScript.