현재 저는 스레드의 첫 번째 게시물 뒤에 배너/링크를 표시하기 위해 다음 위젯을 사용하고 있습니다. 지금까지는 잘 작동하고 있습니다:
<script type="text/discourse-plugin" version="0.8">
const { iconNode } = require("discourse-common/lib/icon-library");
api.decorateWidget("post:after", helper => {
const firstPost = helper.attrs.firstPost;
const h = helper.h;
if (firstPost) {
return h("div#support", [
h(
'a.icon', {
href:'link',
title: 'Support-Icon'
}, iconNode('heart')),
h(
'a.link', {
href: "link",
title: 'Support-Link'
}, 'some text',
),
]);
}
});
</script>
하지만 저는 배너/링크를 다른 위치에 통합하고 싶습니다. 즉, 답변 버튼 바로 앞입니다. 아래에서 해당 위치를 빨간색으로 표시해 두었습니다:
이것을 구현하는 방법에 대한 팁을 주실 수 있을까요?
위치가/역할이 이것으로 정의된다는 것은 알고 있습니다. 문제는 이 NAME:LOCATION을 어떻게 찾는가입니다:
api.decorateWidget("NAME:LOCATION", helper => {
Moin
2
그림에서 표시한 위치는 해당 토픽의 모든 게시물 이후입니다. 따라서 답글이 있는 경우 배너는 첫 번째 게시물 바로 아래가 아니라, 그 답글들 아래에 표시됩니다.
piffy
3
여기에는 topic-above-footer-buttons라는 플러그인 아웃렛이 있습니다.
이 링크에서 위치를 확인할 수 있습니다:
(deprecated) Plugin outlet locations theme component
그 다음 이 가이드를 따르세요:
감사합니다. 작동했습니다.
Head용 코드 예시:
<script type='text/x-handlebars' data-template-name='/connectors/topic-footer-main-buttons-before-create/team-support'>
<div id="support">
<a href="link" title="Support-Icon" class="icon">
<svg class="fa d-icon d-icon-heart svg-icon svg-node" aria-hidden="true"><use xlink:href="#heart"></use></svg>
</a>
<a href="link" title="Support-Link" class="link">text</a>
</div>
</script>
안타깝게도 해당 버튼/배너는 사용자가 로그인한 상태일 때만 표시됩니다. 미등록 사용자에게도 버튼/배너가 표시되도록 하려면 어떻게 해야 하나요?
다음 테마 위치를 사용하고 있습니다: topic-footer-main-buttons-before-create