不,你需要将这些添加到 CSS 部分。
所以所有内容将整合在一起。
通用 / 头部 ![]()
<script type="text/discourse-plugin" version="0.8">
api.decorateWidget("post:after", helper => {
const firstPost = helper.attrs.firstPost;
const h = helper.h;
if (firstPost) {
return h("div#custom-ad", [
h(
"a.custom-ad-link",
{ href: "example.com" },
h("img", { src: "https://picsum.photos/id/74/750/90" })
)
]);
}
});
</script>
通用 / CSS ![]()
#custom-ad {
.custom-ad-link {
img {
width: 100%;
}
}
}
桌面端 / CSS ![]()
#custom-ad {
max-width: calc(45px + 690px + (11px * 2));
}


