Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Svelte head components NOT rendered from Svelte-Kit server

$
0
0

Components inside <svelte:head> is not rendered by SSR.

Steps to Reproduce

  1. Set up a basic svelte app using the following steps:
npm create svelte@latest my-appcd my-appnpm installnpm run dev
  1. Then go to http://localhost:5173/ and check
    • what is rendered by SSR?
    • what is rendered by CSR?

The below meta and title information in +page.svelte is not rendered in SSR

<script>    ....</script><svelte:head><title>Home</title><meta name="description" content="Svelte demo app" /></svelte:head><section><h1>        ....</h1>        ...</section>

SSR Output - No title and meta information

<html lang="en"><head><meta charset="utf-8" /><link rel="icon" href="./favicon.png" /><meta name="viewport" content="width=device-width, initial-scale=1" /></head><body data-sveltekit-preload-data="hover">    ....</body></html>

CSR Output - title and meta information is present

<html lang="en"><head><meta charset="utf-8"><link rel="icon" href="http://localhost:5173/favicon.png"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Home</title><meta name="description" content="Svelte demo app" class="s-y_bCXRrkrYfP"> </head><body data-sveltekit-preload-data="hover">      ...</body></html>

Expected

title and meta should be rendered in SSR. Without the meta tags my website's SEO is dead; meta tags are crucial from crawler's point of view.

I request someone to please give some pointers how to resolve this issue.


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>