Add component

My site would benefit from a component, that would work similarly to the already existing <client-only> component.

There is a component that relies on WebSockets (to keep the data updated at all times), which I wrap in a <client-only> tag. However I’d like search engines to render some text in its place (which won’t be updated in real-time). For this, I would like my component to be able to have a <client-only> and a <server-only> part.

I haven’t found an alternative way to achieve this effect.

1 possible answer(s) on “Add component

  1. If I understood you correctly you already be able to solve your problem with just the client-only component.
    You can provide the component with an optional placeholder slot (see the second example here) which is only rendered server side.

    So having a server only part should be achievable like this

          <!-- empty default slot -->
          <!-- only rendered on server side-->
          <server-only slot="placeholder" />