Polaris Astro documentation

SEO and sharing

What Polaris does for search engines and social sharing, the structured data it adds for each page type, and what to set before you launch.

Before you launch

  1. Domain: set site in astro.config.mjs and url in src/site.config.ts to your address. Canonical URLs, the sitemap, share images and structured data all use them.
  2. Descriptions: give every page file a description, up to 170 characters, saying what the page is about. Trips, stays and destinations use their summary, and journal posts use theirs.
  3. Share image: set shareImage in site.config.ts to a photo in src/assets/images/. Pages with their own photo, such as trips and posts, use that instead, and a page file can set image: to choose one.
  4. Business details: fill in legalName, founded, priceRange, phone, email and address in site.config.ts. They go into your structured data.
  5. Photo descriptions: write a real imageAlt for every photo.
  6. Demo pages: delete src/pages/blocks.astro and src/pages/style-guide.astro if you don’t want the block library and style guide online. They are already left out of the sitemap and disallowed in robots.txt.

What Polaris does for you

  • A canonical URL, title and description on every page. The title is the page title followed by your name.
  • Open Graph and Twitter Card tags with a 1200 x 630 image, so links look good when shared.
  • A sitemap at /sitemap-index.xml, and a robots.txt that allows crawlers, points to the sitemap and disallows /blocks/ and /style-guide/.
  • An RSS feed of your journal at /journal/rss.xml.
  • Structured data (JSON-LD) for each page type, written automatically in src/lib/seo.ts (see below).
  • Clean HTML: the first heading on each page is the one h1, forms have labels and photos have descriptions.
  • A static site with almost no JavaScript, which keeps pages fast.

Structured data

Page Structured data
Every page except the home page BreadcrumbList
Home, about and contact pages TravelAgency, built from name, legalName, tagline, phone, email, address, founded, priceRange and social
Trips TouristTrip, with an Offer for each upcoming departure (or one offer from priceFrom), the itinerary as a list, and the trip style
Stays LodgingBusiness, Campground (for camp), BedAndBreakfast (for homestay and guesthouse) or Hotel (for boutique and luxury), with location, price range, check-in and check-out times and amenities
Destinations TouristDestination, with location
Journal posts BlogPosting, with the author and date
faq blocks FAQPage

Reviews are left out of the structured data on purpose, because search engines ignore ratings a business publishes about itself.

If a page has more than one faq block, set jsonld: false on all but one, so the page has a single FAQ list.

Hiding a page from search engines

Add noindex: true to a page file. It adds a noindex tag, removes the page from the sitemap and leaves it out of site search.

After launch

Add your site to Google Search Console and submit https://yourdomain.com/sitemap-index.xml. Do the same in Bing Webmaster Tools.

Site search is covered in Search.