Skip to content
svead

Best Practices

Date Formatting

Always use ISO 8601 format for dates:

TypeScript
1// Good - ISO format
2const date = new Date().toISOString(); // "2023-08-22T10:00:00.000Z"
3const formatted = format(new Date(), "yyyy-MM-dd'T'HH:mm:ssxxx"); // "2023-08-22T10:00:00+00:00"
4
5// Use in schema
6const schema = {
7	'@type': 'BlogPosting',
8	datePublished: date,
9	dateModified: date,
10};

Image Properties

Include alt text for Open Graph images:

TypeScript
1const seo_config: SeoConfig = {
2	title: 'Page Title',
3	description: 'Page description',
4	url: 'https://example.com',
5	open_graph_image: 'https://example.com/image.jpg',
6	open_graph_image_alt: 'Descriptive alt text for the image',
7};

Validation

Always validate your structured data:

Type Safety

Use TypeScript for type safety:

TypeScript
1import type { SeoConfig, SchemaOrgProps } from 'svead';
2
3// TypeScript will catch errors
4const seo_config: SeoConfig = {
5	title: 'Required',
6	description: 'Required',
7	url: 'Required',
8	// Optional properties have autocomplete
9	open_graph_image: '...',
10};
11
12// Schema types from schema-dts
13const schema: SchemaOrgProps['schema'] = {
14	'@type': 'BlogPosting', // Autocomplete available
15	headline: '...',
16	// TypeScript validates properties
17};

Language

There is no default language. Set language to have og:locale rendered, using Open Graph’s language_TERRITORY format:

TypeScript
1const seo_config: SeoConfig = {
2	title: 'Page Title',
3	description: 'Description',
4	url: 'https://example.com',
5	language: 'en_GB',
6};

Twitter Card Types

Choose the right Twitter card type:

TypeScript
1const seo_config: SeoConfig = {
2	// ...
3	twitter_card_type: 'summary_large_image', // Default, best for most content
4	// twitter_card_type: 'summary', // Smaller image
5	// twitter_card_type: 'player', // For video/audio
6	// twitter_card_type: 'app', // For mobile apps
7};

Web Monetization

Add payment pointer for Web Monetization:

TypeScript
1const seo_config: SeoConfig = {
2	title: 'Page Title',
3	description: 'Description',
4	url: 'https://example.com',
5	payment_pointer: '$ilp.uphold.com/your-payment-pointer',
6};
All documentation