Svelte SEO

Svelte SEO is a plugin that makes managing your SEO easier in Svelte projects.

Installing

Install using yarn:

yarn add svelte-seo

or npm:

npm install --save svelte-seo

Add SEO to Page

mport Svelte SEO and add the desired properties. This will render out the tags in the <head> for SEO. At a bare minimum, you should add a title and description.

<script>
  import SvelteSeo from "svelte-seo";
</script>

<SvelteSeo
  title="Simple Usage Example"
  description="A short description goes here."
/>

Svelte SEO options

PropertyTypeDescription
titlestringSets the page meta title.
descriptionstringSets the page meta description.
noindexboolean (default false)Sets whether page should be indexed or not. More Info.
nofollowboolean (default false)Sets whether page should be followed or not. More Info.
keywordsstringSet the page keywords.
canonicalstringSet the page canonical url.
openGraph.typestringThe type of your object. Depending on the type you specify, other properties may also be required More Info.
openGraph.titlestringThe open graph title, this can be different than your meta title.
openGraph.descriptionstringThe open graph description, this can be different than your meta description.
openGraph.urlstringThe canonical URL of your object that will be used as its permanent ID in the graph.
openGraph.imagesobject[]An array of images to be used as a preview. If multiple supplied you can choose one when sharing. See Examples
openGraph.article.publishedTimedatetimeWhen the article was first published. See Examples.
openGraph.article.modifiedTimedatetimeWhen the article was last changed.
openGraph.article.expirationTimedatetimeWhen the article is out of date after.
openGraph.article.authorsstring[]Writers of the article.
openGraph.article.sectionstringA high-level section name. E.g. Technology
openGraph.article.tagsstring[]Tag words associated with this article.
twitter.cardstringCard type (one of summarysummary_large_imageplayer), defaults to summary_large_image
twitter.sitestringThe Twitter @username the card should be attributed to.
twitter.titlestringA concise title for the related content. Note- iOS, Android: Truncated to two lines in timeline and expanded Tweet ; Web: Truncated to one line in timeline and expanded Tweet
twitter.descriptionstringA description that concisely summarizes the content as appropriate for presentation within a Tweet. You should not re-use the title as the description or use this field to describe the general services provided by the website. Note- iOS, Android: Not displayed ; Web: Truncated to three lines in timeline and expanded Tweet
twitter.imagestring(url)A URL to a unique image representing the content of the page. Images for this Card support an aspect ratio of 2:1 with minimum dimensions of 300×157 or maximum of 4096×4096 pixels. Images must be less than 5MB in size. JPG, PNG, WEBP and GIF formats are supported. Only the first frame of an animated GIF will be used. SVG is not supported.
twitter.imageAltstringA text description of the image conveying the essential nature of an image to users who are visually impaired. Maximum 420 characters.
twitter.playerstringUrl for the video to play in the card. Only used with the player type card.
twitter.playerWidthnumberWidth of the player that plays the content on twitter (in Pixels). Only used with the player type card.
twitter.playerHeightnumberHeight of the player that plays the content on twtter (in Pixels). ONly used with the player type card.
jsonLdobjectData in ld+json format. 

Leave a comment

Your email address will not be published. Required fields are marked *