Tilbage til Schema
🔍

SearchAction Schema

Få en sitelinks searchbox direkte i Google søgeresultater

Hvad er SearchAction Schema?

SearchAction schema (også kaldet Sitelinks Searchbox) tilføjer en søgeboks direkte under dit brand når folk søger på dit site navn i Google. Det gør det nemt for brugere at søge direkte på dit site uden først at besøge det.

Fordele:

  • • Søgeboks direkte i Google SERP
  • • Bedre brand presence i søgeresultater
  • • Hurtigere bruger navigation
  • • Højere engagement rate
  • • Professional appearance

Requirements

For at få sitelinks searchbox skal du:

  • • Have en fungerende search funktion på dit site
  • • Implementere SearchAction schema korrekt
  • • Google skal allerede vise sitelinks for dit brand
  • • Dit site skal have tilstrækkelig autoritet

Complete Example

WebSite med SearchAction

{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "Example Site",
  "url": "https://www.example.com",
  "potentialAction": {
    "@type": "SearchAction",
    "target": {
      "@type": "EntryPoint",
      "urlTemplate": "https://www.example.com/search?q={search_term_string}"
    },
    "query-input": "required name=search_term_string"
  }
}

URL Template Format

urlTemplate skal matche dit sites search URL format:

Standard format:https://example.com/search?q={search_term_string}
Alternative formats:https://example.com/s/{search_term_string}https://example.com/?s={search_term_string}
Vigtigt: {search_term_string} skal være i URL'en præcis som vist

Next.js Implementation

// app/layout.tsx
export default function RootLayout({ children }) {
  const searchActionSchema = {
    "@context": "https://schema.org",
    "@type": "WebSite",
    "name": "Example Site",
    "url": "https://www.example.com",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://www.example.com/search?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  };

  return (
    <html>
      <head>
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{
            __html: JSON.stringify(searchActionSchema)
          }}
        />
      </head>
      <body>{children}</body>
    </html>
  );
}

Multiple Search Options

Du kan tilbyde forskellige search endpoints (f.eks. forskellige sektioner):

{
  "@type": "WebSite",
  "potentialAction": [
    {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://example.com/search?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    },
    {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://example.com/products/search?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  ]
}

Best Practices

✓ Gør dette

  • • Test search URL fungerer korrekt
  • • Brug HTTPS URLs
  • • Match dit faktiske search URL format
  • • Implementer på homepage/root domain
  • • Verificer med Rich Results Test
  • • Hav en god, hurtig search funktion

✗ Undgå dette

  • • Forkert URL template format
  • • Search URL der ikke virker
  • • Manglende search funktion på site
  • • Implementering på subdomains
  • • Duplicate schema markup
  • • Fejl i {search_term_string} placeholder