Comment ajouter du HTML client après « post_1 » (partie 2)

Non, vous devez les ajouter aux sections CSS.

Voici donc l’ensemble.

Commun / En-tête :arrow_down:

<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>


Commun / CSS :arrow_down:

#custom-ad {
  .custom-ad-link {
    img {
      width: 100%;
    }
  }
}


Bureau / CSS :arrow_down:

#custom-ad {
  max-width: calc(45px + 690px + (11px * 2));
}