Re: [w3c/webcomponents] Is or how can Shadow DOM be 'SEO friendly'? (#500)

@hayatoito how does this affect applications that may use web components to reuse parts of their application that may contain information they want to be crawlable? For example, I may have an `<x-app>` component that contains information in its shadow root that it wants to reuse everywhere while only allowing certain things to be customised via slots.

```html
<x-app>
  <p slot="description">This page is cool etc.</p>
</x-app>
```

Which may render out to:

```html
<x-app>
  #shadow-root
    <h1>My rad company</h1>
    <slot name="description">
      <p slot="description">This page is coo etc.</p>
    </slot>
</x-app>
```

While this is a contrived example, there could be several other things that isn't worth making the consumer of this component aware of. Preventing shadow roots from being crawlable may pigeon-hole web components into only being practical when used as leaf nodes - or otherwise forcing the consumer to specify *all* content - which wouldn't be intuitive.

I see this as a similar problem to #499. Maybe a solution for this is for search engines to force all shadow roots to be open by overriding `attachShadow()` so that they can crawl into them via the `shadowRoot` property. Is this too obtuse for crawlers to have to do?

Another solution may be to put the onus on the developers of the components - rather than just the consumers to put everything they want crawlable into the light DOM - to ensure that if they want their components to be crawlable, that they make the shadow roots in question "open". It'd be really useful if one could specify "closed" while still having stuff crawled, though, these may be mutually exclusive. Maybe this is an argument for going back to the drawing board here. Closed shadow roots are hardly a deterrent for the determined and open by default solves several issues others outside of the working groups have raised.

A solution for crawlers that don't support JavaScrip would be to support server-side rendering of shadow roots. Tangental to this, this is something that a *lot* of people are going to be crying for if web components are to be used as a building block for applications. I see no reason that they shouldn't be either since it's a lower-level API that doesn't guide people in a particular direction and has already worked quite well in practice: a la Polymer, Skate (what we use) etc.

Saying that users must provide all crawlable content via light DOM severely limits the possibilities for web components and there needs to be a clear path for how things like this will be done - even if it means re-discussing open vs closed - especially since web components are a set of lower-level APIs that don't guide the developer down an ideal path.



---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/500#issuecomment-220493327

Received on Friday, 20 May 2016 01:12:15 UTC