Skip to content

Instantly share code, notes, and snippets.

@arutnik
Last active August 2, 2018 19:38
Show Gist options
  • Save arutnik/f44dcdfbe237aaa9f71a35f7630b298f to your computer and use it in GitHub Desktop.
Save arutnik/f44dcdfbe237aaa9f71a35f7630b298f to your computer and use it in GitHub Desktop.
SEO-SPA: Hiding with CSS
@Component({
selector: 'app-root',
template: `
<span class="hidden">This text is important for a
crawler to see, but I can't have it on screen
because I need to put my human users first and
they get to see a rich visual experience instead
of this text. So I hide it with CSS. Remember that
this will penalize this text's importance, but it's
better than not having it visible to crawlers at all.
</span>
<my-awesome-canvas-component ></my-awesome-canvas-component>
`,
styles: ['.hidden { display: none; }']
})
export class AppComponent {
/* . . . */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment