Last checked with Wasp 0.21.
This guide depends on external libraries or services, so it may become outdated over time. We do our best to keep it up to date, but make sure to check their documentation for any changes.Adding SEO metadata to your Wasp app
This guide shows you how to set up meta tags for your Wasp application to improve SEO and enable rich previews when your app is shared on platforms like Slack, X, or Discord.
How to add <meta> tags
Setting metadata for every page
You can add meta tags to your application using the head property in your app declaration. These tags will be included in the <head> section of your HTML.
app MyApp {
wasp: {
version: "^0.21.0"
},
title: "My App",
head: [
"<link rel='icon' href='/favicon.ico' />",
"<meta name='description' content='Your apps main description and features.' />",
"<meta name='author' content='Your (App) Name' />",
"<meta name='keywords' content='saas, solution, product, app, service' />",
// Open Graph tags for social media previews
"<meta property='og:type' content='website' />",
"<meta property='og:title' content='Your App Name' />",
"<meta property='og:site_name' content='Your App Name' />",
"<meta property='og:url' content='https://your-app.com' />",
"<meta property='og:description' content='Your apps main description and features.' />",
"<meta property='og:image' content='https://your-app.com/public-banner.webp' />",
// Twitter Card tags
"<meta name='twitter:image' content='https://your-app.com/public-banner.webp' />",
"<meta name='twitter:image:width' content='800' />",
"<meta name='twitter:image:height' content='400' />",
"<meta name='twitter:card' content='summary_large_image' />",
],
}
Setting metadata for a specific page
You can use React's support for <meta> tags within components to set metadata for specific pages. This allows you to customize the metadata based on the content of each page. These tags will only be included in the page when the component is being shown, so it's better to add them to the top-most level if possible.
export function HomePage() {
return (
<>
<head>
<meta
name="description"
content="Home page description specific to this page."
/>
<meta property="og:title" content="Home Page - My App" />
<meta
property="og:description"
content="Description for the home page."
/>
<meta
property="og:image"
content="https://your-app.com/home-page-banner.webp"
/>
<meta name="twitter:card" content="summary_large_image" />
</head>
<div>
<h1>Welcome to the Home Page</h1>
{/* The rest of the page content */}
</div>
</>
);
}
Recommended <meta> Tags
Basic SEO tags
description: A brief description of your app (appears in search results)author: The creator or company namekeywords: Relevant keywords for search engines
Open Graph tags
This is the most common standard used by social media platforms (e.g. Facebook, LinkedIn, Slack, Discord, and more) to generate rich link previews.
og:type: Usually "website" for web appsog:title: The title shown in previewsog:site_name: Your app/site nameog:url: The canonical URLog:description: Description for the previewog:image: Preview image URL
You can check Open Graph tag guidelines for more information on how this information is used.
X Card tags
This is used by X (formerly Twitter) to create rich link previews.
twitter:card: Use "summary_large_image" for large image previewstwitter:image: Image URL for Twitter previewstwitter:image:width: Image width in pixelstwitter:image:height: Image height in pixels
You can check X's guidelines for more information on how this information is used.
Best practices for images
- Use your client app's absolute URL (including
https://) for your preview images. - Check the recommended dimensions for each platform's images in their documentation.
- Keep important content centered (some platforms crop differently).
- Use WebP or PNG format for best quality.
- Place your image in the
public/folder.
Testing your metadata
After deploying, you can verify your meta tags using these tools: