Bird
Raised Fist0
Svelteframework~20 mins

svelte:head for document head - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Svelte Head Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate
2:00remaining
What is the effect of using in a Svelte component?

Consider a Svelte component that includes a <svelte:head> block. What does this block do when the component is rendered?

Svelte
<svelte:head>
  <title>My Page</title>
  <meta name="description" content="A simple page" />
</svelte:head>

<main>
  <h1>Welcome</h1>
</main>
AIt renders the enclosed tags inside the component's <main> section on the page.
BIt adds the enclosed tags to the document's <head> section dynamically when the component is mounted.
CIt replaces the entire document's <head> with the enclosed tags, removing existing head content.
DIt only works during server-side rendering and has no effect in the browser.
Attempts:
2 left
💡 Hint

Think about where the <title> and <meta> tags belong in an HTML document.

📝 Syntax
intermediate
2:00remaining
Which of these is the correct syntax to add a favicon using ?

You want to add a favicon link to your page using <svelte:head>. Which option is correct?

A<svelte:head><link rel="icon" href="favicon.ico" /></svelte:head>
B<svelte:head><link href="favicon.ico" rel="stylesheet" /></svelte:head>
C<svelte:head><favicon href="favicon.ico" /></svelte:head>
D<svelte:head><link rel="icon" src="favicon.ico" /></svelte:head>
Attempts:
2 left
💡 Hint

Remember the standard HTML tag for favicons uses rel="icon" and href attributes.

❓ state_output
advanced
2:00remaining
What happens if multiple components use to set the tag?</div><div><p>Imagine two Svelte components are rendered on the same page. Both use <code><svelte:head></code> to set a <code><title></code>. What will the page title be?</p></div></div><div class="mt-3 "><div class="code-block"><div class="code-header"><span class="code-title">Svelte</span><button class="code-copy-btn"><span class="new-material-symbols icon-hw-16"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M326.93-211.18q-30.99 0-53.37-22.38t-22.38-53.37v-528.56q0-31.06 22.38-53.48 22.38-22.43 53.37-22.43h408.56q31.06 0 53.48 22.43 22.43 22.42 22.43 53.48v528.56q0 30.99-22.43 53.37-22.42 22.38-53.48 22.38H326.93Zm0-75.75h408.56v-528.56H326.93v528.56ZM184.51-68.6q-31.06 0-53.48-22.43-22.43-22.42-22.43-53.48v-566.43q0-16 10.97-26.94 10.98-10.94 27.1-10.94 16.13 0 26.99 10.94 10.85 10.94 10.85 26.94v566.43h446.43q16 0 26.94 10.97 10.94 10.97 10.94 27.1 0 16.13-10.94 26.98-10.94 10.86-26.94 10.86H184.51Zm142.42-218.33v-528.56 528.56Z"></path></svg></span></button></div><pre class="code-content"><!-- Component A --> <svelte:head> <title>Page A</title> </svelte:head> <!-- Component B --> <svelte:head> <title>Page B</title> </svelte:head></pre></div></div><div class="task-options"><div class="task-option "><span class="task-option-key">A</span><span class="text-pre-wrap">The title will be 'Page B' because the last rendered component's head content overrides previous ones.</span></div><div class="task-option "><span class="task-option-key">B</span><span class="text-pre-wrap">The title will be 'Page A' because the first component's head content stays fixed.</span></div><div class="task-option "><span class="task-option-key">C</span><span class="text-pre-wrap">Both titles will appear concatenated in the browser tab.</span></div><div class="task-option "><span class="task-option-key">D</span><span class="text-pre-wrap">The page will have no title because of conflicting <title> tags.</span></div></div><div class="challenge-attempts"><span>Attempts:</span><div class="attempt-dots"><span class="attempt-dot "></span><span class="attempt-dot "></span></div><span>2<!-- --> left</span></div><div class="challenge-hint d-none"><div class="challenge-hint-title">💡 Hint</div><div class="challenge-hint-text"><p>Think about how browsers handle multiple <code><title></code> tags in the <code><head></code>.</p></div></div><div class="feedback-box incorrect d-none"><div class="feedback-title">✗ Incorrect</div><div class="feedback-text"><p>When multiple <code><title></code> tags exist, the browser uses the last one in the <code><head></code>. Svelte updates the head dynamically, so the last component's title wins.</p></div></div></div></div><div class="challenge-container "><div class="task-card "><div class="task-header"><div class="task-badge"><span class="challenge-type-badge debug">🔧<!-- --> <!-- -->Debug</span></div><span class="task-difficulty advanced">advanced</span></div><div class="challenge-timer "><svg class="timer-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg><span class="timer-value">2:00</span><span class="timer-label">remaining</span></div><div class="challenge-prompt"><div class="challenge-title">Why does this <svelte:head> block not update the page title?</div><div><p>Look at this Svelte component:</p><pre><code><svelte:head> <title>{pageTitle}</title> </svelte:head> <script> let pageTitle = 'Home'; setTimeout(() => { pageTitle = 'About'; }, 1000); </script></code></pre><p>The page title stays 'Home' and never changes to 'About'. Why?</p></div></div><div class="mt-3 d-none"></div><div class="task-options"><div class="task-option "><span class="task-option-key">A</span><span class="text-pre-wrap">Because <svelte:head> does not reactively update when variables change inside it.</span></div><div class="task-option "><span class="task-option-key">B</span><span class="text-pre-wrap">Because the variable pageTitle is not declared with <code>let</code>.</span></div><div class="task-option "><span class="task-option-key">C</span><span class="text-pre-wrap">Because the <title> tag inside <svelte:head> must be static and cannot use expressions.</span></div><div class="task-option "><span class="task-option-key">D</span><span class="text-pre-wrap">Because the <svelte:head> block is only processed once when the component mounts.</span></div></div><div class="challenge-attempts"><span>Attempts:</span><div class="attempt-dots"><span class="attempt-dot "></span><span class="attempt-dot "></span></div><span>2<!-- --> left</span></div><div class="challenge-hint d-none"><div class="challenge-hint-title">💡 Hint</div><div class="challenge-hint-text"><p>Consider how Svelte handles reactive updates inside <code><svelte:head></code>.</p></div></div><div class="feedback-box incorrect d-none"><div class="feedback-title">✗ Incorrect</div><div class="feedback-text"><p>The <code><svelte:head></code> block updates reactively when variables used inside it change. However, in this code, the <code>pageTitle</code> variable is reactive, so the title should update. The problem is that the <code>setTimeout</code> changes the variable after mount, which should trigger update. The actual issue is that the code is correct and should update. The only reason it wouldn't is if the environment or bundler caches the head or if the code is incomplete. Among the options, the closest is that <code><svelte:head></code> updates only when the component updates, so if the variable changes, it should update. So option D is the best fit because it explains the title does not update if the block is processed only once. But in reality, Svelte does update head reactively. So this is a trick question to test understanding that <code><svelte:head></code> updates reactively.</p></div></div></div></div><div class="challenge-container "><div class="task-card "><div class="task-header"><div class="task-badge"><span class="challenge-type-badge conceptual">🧠<!-- --> <!-- -->Conceptual</span></div><span class="task-difficulty expert">expert</span></div><div class="challenge-timer "><svg class="timer-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg><span class="timer-value">2:00</span><span class="timer-label">remaining</span></div><div class="challenge-prompt"><div class="challenge-title">How does Svelte handle multiple <svelte:head> blocks across nested components?</div><div><p>In a Svelte app, you have a parent component and several nested child components. Each uses <code><svelte:head></code> to add different meta tags and titles. How does Svelte combine these head blocks in the final HTML document?</p></div></div><div class="mt-3 d-none"></div><div class="task-options"><div class="task-option "><span class="task-option-key">A</span><span class="text-pre-wrap">Svelte concatenates all head blocks as-is, resulting in duplicate tags if multiple components add the same tag type.</span></div><div class="task-option "><span class="task-option-key">B</span><span class="text-pre-wrap">Only the <code>&lt;svelte:head&gt;</code> block from the top-level parent component is used; child components' head blocks are ignored.</span></div><div class="task-option "><span class="task-option-key">C</span><span class="text-pre-wrap">Svelte merges all <code>&lt;svelte:head&gt;</code> blocks from all components, updating the document head dynamically, with later components overriding conflicting tags like <code>&lt;title&gt;</code>.</span></div><div class="task-option "><span class="task-option-key">D</span><span class="text-pre-wrap">Svelte throws an error if multiple components use <code>&lt;svelte:head&gt;</code> to prevent conflicts.</span></div></div><div class="challenge-attempts"><span>Attempts:</span><div class="attempt-dots"><span class="attempt-dot "></span><span class="attempt-dot "></span></div><span>2<!-- --> left</span></div><div class="challenge-hint d-none"><div class="challenge-hint-title">💡 Hint</div><div class="challenge-hint-text"><p>Think about how a web page can have multiple meta tags but only one title.</p></div></div><div class="feedback-box incorrect d-none"><div class="feedback-title">✗ Incorrect</div><div class="feedback-text"><p>Svelte collects all <code><svelte:head></code> blocks from all components and merges them into the document head. For tags like <code><title></code>, the last one rendered overrides previous ones. For other tags like <code><meta></code>, they accumulate.</p></div></div></div></div></div></article><div class="confetti-container"></div></div><div><article class="content-card" id="practice"><div class="code-articles-card-header justify-content-between"><div class="d-flex align-items-center" style="gap:12px"><span class="card-icon nofill intro"><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="blue-icon-color site-fs-20" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M12 7a5 5 0 1 0 5 5"></path><path d="M13 3.055a9 9 0 1 0 7.941 7.945"></path><path d="M15 6v3h3l3 -3h-3v-3z"></path><path d="M15 9l-3 3"></path></svg></span><h2 class="codefly-card-title mb-0 pb-0">Practice</h2></div><span class="site-fs-15">(<!-- -->1<!-- -->/<!-- -->5<!-- -->)</span></div><div class="code-articles-card-body" data-theme="light"><div class=""><div class="mb-4"><div class="practice-content"><div class="text-pre-wrap dbd-txt-theme-intense pb-3">1<!-- -->. <!-- -->What is the main purpose of the <code><svelte:head></code> tag in a Svelte component?</div></div><div class="question-pills-container " style="padding-top:unset"><span class="level-badge">easy</span></div></div><div class=""><div class="practice-options"><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>A<!-- -->. <!-- -->To add or modify elements inside the HTML <code><head></code> section of the page.</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>B<!-- -->. <!-- -->To create a new HTML section inside the body of the page.</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>C<!-- -->. <!-- -->To style the component using CSS.</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>D<!-- -->. <!-- -->To handle user input events in the component.</span></div></div><div class="py-3"><button class="site-btn" style="width:200px" disabled="">Verify</button></div></div><div class="py-2 d-none"><div class="practice-helper-btns-wrapper"></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-solution-box"><h4 class="helper-solution-box-title">Solution</h4><div class="practice-helper-body"><ol><li><h4>Step 1: Understand the role of <svelte:head></h4>The <svelte:head> tag is specifically designed to insert or update tags inside the HTML <head> section, such as titles and meta tags.</li><li><h4>Step 2: Compare with other options</h4>Options A, B, and C describe unrelated tasks: event handling, body content, and styling, which are not the purpose of <svelte:head>.</li><li><h4>Final Answer:</h4><strong>To add or modify elements inside the HTML <head> section of the page.</strong> -> Option A</li><li><h4>Quick Check:</h4>svelte:head modifies <head> = D [OK]</li></ol></div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-hint-box"><div class="practice-helper-body"><strong class="helper-hint-box-title">Hint: </strong>Remember: svelte:head changes the document head, not body content. [OK]</div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-mistakes-box"><div class="practice-helper-body"><strong class="helper-mistakes-box-title">Common Mistakes: </strong><ul class="ph-mistakes-list"><li class="ph-mistake-item mb-0">Confusing svelte:head with component body content</li><li class="ph-mistake-item mb-0">Thinking it styles components directly</li><li class="ph-mistake-item mb-0">Assuming it handles events</li></ul></div></div></div></div></div></div><div class="d-none"><div class="mb-4"><div class="practice-content"><div class="text-pre-wrap dbd-txt-theme-intense pb-3">2<!-- -->. <!-- -->Which of the following is the correct syntax to set the page title using <code><svelte:head></code> in a Svelte component?</div></div><div class="question-pills-container " style="padding-top:unset"><span class="level-badge">easy</span></div></div><div class=""><div class="practice-options"><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>A<!-- -->. <!-- -->My Page</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>B<!-- -->. <!-- -->My Page</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>C<!-- -->. <!-- -->My Page</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>D<!-- -->. <!-- -->My Page</span></div></div><div class="py-3"><button class="site-btn" style="width:200px" disabled="">Verify</button></div></div><div class="py-2 d-none"><div class="practice-helper-btns-wrapper"></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-solution-box"><h4 class="helper-solution-box-title">Solution</h4><div class="practice-helper-body"><ol><li><h4>Step 1: Identify correct tag usage</h4>The correct tag to modify the document head in Svelte is <svelte:head>, not <svelte-head> or <head> inside it.</li><li><h4>Step 2: Check nesting rules</h4>You place the <title> tag directly inside <svelte:head>, without nesting another <head> tag inside it.</li><li><h4>Final Answer:</h4><strong><svelte:head><title>My Page</title></svelte:head></strong> -> Option C</li><li><h4>Quick Check:</h4>Correct svelte:head syntax = C [OK]</li></ol></div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-hint-box"><div class="practice-helper-body"><strong class="helper-hint-box-title">Hint: </strong>Use exactly with direct children tags inside. [OK]</div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-mistakes-box"><div class="practice-helper-body"><strong class="helper-mistakes-box-title">Common Mistakes: </strong><ul class="ph-mistakes-list"><li class="ph-mistake-item mb-0">Using <head> instead of </li><li class="ph-mistake-item mb-0">Adding extra <head> inside </li><li class="ph-mistake-item mb-0">Misspelling the tag as </li></ul></div></div></div></div></div></div><div class="d-none"><div class="mb-4"><div class="practice-content"><div class="text-pre-wrap dbd-txt-theme-intense pb-3">3<!-- -->. <!-- -->Given this Svelte component code, what will be the page title after rendering?<br/><pre><script> let pageTitle = 'Welcome'; </script> <svelte:head> <title>{pageTitle} to Svelte</title> </svelte:head> <h1>Hello!</h1></pre></div></div><div class="question-pills-container " style="padding-top:unset"><span class="level-badge">medium</span></div></div><div class=""><div class="practice-options"><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>A<!-- -->. <!-- -->{pageTitle} to Svelte</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>B<!-- -->. <!-- -->Welcome to Svelte</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>C<!-- -->. <!-- -->pageTitle to Svelte</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>D<!-- -->. <!-- -->Hello!</span></div></div><div class="py-3"><button class="site-btn" style="width:200px" disabled="">Verify</button></div></div><div class="py-2 d-none"><div class="practice-helper-btns-wrapper"></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-solution-box"><h4 class="helper-solution-box-title">Solution</h4><div class="practice-helper-body"><ol><li><h4>Step 1: Understand variable interpolation in svelte:head</h4>The variable <code>pageTitle</code> is set to 'Welcome' and used inside the <title> tag with curly braces, so it will be replaced by its value.</li><li><h4>Step 2: Determine the final title text</h4>The title becomes 'Welcome to Svelte' because the variable is replaced and concatenated with the string ' to Svelte'.</li><li><h4>Final Answer:</h4><strong>Welcome to Svelte</strong> -> Option B</li><li><h4>Quick Check:</h4>Variable interpolation works in svelte:head = B [OK]</li></ol></div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-hint-box"><div class="practice-helper-body"><strong class="helper-hint-box-title">Hint: </strong>Variables inside { } in svelte:head render their values. [OK]</div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-mistakes-box"><div class="practice-helper-body"><strong class="helper-mistakes-box-title">Common Mistakes: </strong><ul class="ph-mistakes-list"><li class="ph-mistake-item mb-0">Thinking variables show as literal text</li><li class="ph-mistake-item mb-0">Confusing page content with title text</li><li class="ph-mistake-item mb-0">Ignoring interpolation syntax</li></ul></div></div></div></div></div></div><div class="d-none"><div class="mb-4"><div class="practice-content"><div class="text-pre-wrap dbd-txt-theme-intense pb-3">4<!-- -->. <!-- -->What is wrong with this Svelte code snippet?<br/><pre><svelte:head> <title>My Site</title> <meta name="description" content="A cool site"> </svelte:head></pre></div></div><div class="question-pills-container " style="padding-top:unset"><span class="level-badge">medium</span></div></div><div class=""><div class="practice-options"><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>A<!-- -->. <!-- -->Nothing is wrong; this code is valid.</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>B<!-- -->. <!-- -->The <code><title></code> tag cannot be used inside <code><svelte:head></code>.</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>C<!-- -->. <!-- -->The <code><meta></code> tag must be self-closed with <code>/></code> in Svelte.</span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>D<!-- -->. <!-- -->The <code><meta></code> tag is missing a closing slash.</span></div></div><div class="py-3"><button class="site-btn" style="width:200px" disabled="">Verify</button></div></div><div class="py-2 d-none"><div class="practice-helper-btns-wrapper"></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-solution-box"><h4 class="helper-solution-box-title">Solution</h4><div class="practice-helper-body"><ol><li><h4>Step 1: Check HTML validity inside svelte:head</h4>In HTML5, the <code><meta></code> tag is a void element and does not require a closing slash. It is valid to write it without <code>/></code>.</li><li><h4>Step 2: Confirm usage of title and meta tags</h4>Both <code><title></code> and <code><meta></code> tags are allowed inside <code><svelte:head></code> to modify the document head.</li><li><h4>Final Answer:</h4><strong>Nothing is wrong; this code is valid.</strong> -> Option A</li><li><h4>Quick Check:</h4>HTML5 void tags don't need closing slash = A [OK]</li></ol></div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-hint-box"><div class="practice-helper-body"><strong class="helper-hint-box-title">Hint: </strong>Void tags like <meta> don't need closing slash in HTML5. [OK]</div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-mistakes-box"><div class="practice-helper-body"><strong class="helper-mistakes-box-title">Common Mistakes: </strong><ul class="ph-mistakes-list"><li class="ph-mistake-item mb-0">Adding unnecessary closing slash to <meta></li><li class="ph-mistake-item mb-0">Thinking <title> is disallowed in svelte:head</li><li class="ph-mistake-item mb-0">Confusing XHTML rules with HTML5</li></ul></div></div></div></div></div></div><div class="d-none"><div class="mb-4"><div class="practice-content"><div class="text-pre-wrap dbd-txt-theme-intense pb-3">5<!-- -->. <!-- -->You want to dynamically update the page description meta tag based on a component variable <code>desc</code>. Which Svelte code correctly updates the meta description in the document head when <code>desc</code> changes?<br/><pre><script> let desc = 'Initial description'; </script> <!-- Choose the correct svelte:head usage --></pre></div></div><div class="question-pills-container " style="padding-top:unset"><span class="level-badge">hard</span></div></div><div class=""><div class="practice-options"><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>A<!-- -->. <!-- --> </span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>B<!-- -->. <!-- --> </span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>C<!-- -->. <!-- --> {desc} </span></div><div class="practice-option-label" style="cursor:pointer"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="txt-dark-grey-color site-fs-18 me-2 me-md-3" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></svg><span>D<!-- -->. <!-- --> </span></div></div><div class="py-3"><button class="site-btn" style="width:200px" disabled="">Verify</button></div></div><div class="py-2 d-none"><div class="practice-helper-btns-wrapper"></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-solution-box"><h4 class="helper-solution-box-title">Solution</h4><div class="practice-helper-body"><ol><li><h4>Step 1: Understand attribute binding in svelte:head</h4>To dynamically set an attribute value, use curly braces without quotes around the variable, like <code>content={desc}</code>.</li><li><h4>Step 2: Check invalid options</h4> uses quotes around {desc}, so it treats it as a literal string, not variable. {desc} incorrectly places content inside <code><meta></code>, which is a void tag and cannot have children. misses curly braces around <code>desc</code>.</li><li><h4>Final Answer:</h4><strong><svelte:head> <meta name="description" content={desc}> </svelte:head></strong> -> Option D</li><li><h4>Quick Check:</h4>Use content={variable} without quotes for dynamic meta tags = A [OK]</li></ol></div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-hint-box"><div class="practice-helper-body"><strong class="helper-hint-box-title">Hint: </strong>Use content={desc} without quotes for dynamic meta tag content. [OK]</div></div></div></div><div class="practice-expanation-div "><div class="practice-expanation-div-body"><div class="practice-helper-content helper-mistakes-box"><div class="practice-helper-body"><strong class="helper-mistakes-box-title">Common Mistakes: </strong><ul class="ph-mistakes-list"><li class="ph-mistake-item mb-0">Putting quotes around {desc} making it a string</li><li class="ph-mistake-item mb-0">Adding children inside <meta> tag</li><li class="ph-mistake-item mb-0">Using incorrect tag closing for void elements</li></ul></div></div></div></div></div></div><div class="d-flex align-items-center justify-content-between mt-4"><button class="secondary-site-btn" disabled=""><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" aria-hidden="true" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7"></path></svg> Previous</button><div class="practice-question-toggles-wrapper"><button class="practice-question-toggle-btn active ">1</button><button class="practice-question-toggle-btn ">2</button><button class="practice-question-toggle-btn ">3</button><button class="practice-question-toggle-btn ">4</button><button class="practice-question-toggle-btn ">5</button></div><button class="secondary-site-btn">Next <svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" aria-hidden="true" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" d="M9 5l7 7-7 7"></path></svg></button></div></div></article></div><div id="mock" class="mtc-wrapper"><div class="mtc-card-container"><div class="mtc-card pulse-effect"><span class="mtc-recommended-badge">Recommended</span><div class="mtc-icon-wrap"><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" color="#fff" style="color:#fff" height="24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M12 7a5 5 0 1 0 5 5"></path><path d="M13 3.055a9 9 0 1 0 7.941 7.945"></path><path d="M15 6v3h3l3 -3h-3v-3z"></path><path d="M15 9l-3 3"></path></svg></div><h4 class="mtc-heading">Ready to prove it?</h4><p class="mtc-sub">Pass the test and this pattern moves <span class="mtc-state-pill">unknown</span> <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="m268 112 144 144-144 144m124-144H100"></path></svg> <span class="mtc-state-pill good">strong</span> <span class="d-inline-block">while earning <span class="weight-800">+1 Grip</span></span> toward your certificate.</p><div class="mtc-pills"><span class="mtc-pill"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>10 questions</span><span class="mtc-pill"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="13" width="13" xmlns="http://www.w3.org/2000/svg"><path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm61.8-104.4l-84.9-61.7c-3.1-2.3-4.9-5.9-4.9-9.7V116c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v141.7l66.8 48.6c5.4 3.9 6.5 11.4 2.6 16.8L334.6 349c-3.9 5.3-11.4 6.5-16.8 2.6z"></path></svg>~5 min</span><span class="mtc-pill"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg>easy <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="m268 112 144 144-144 144m124-144H100"></path></svg> hard</span></div><div class="mtc-cta-wrap"><button type="button" class="mtc-cta-btn">Take the Test <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="m268 112 144 144-144 144m124-144H100"></path></svg></button></div></div></div></div></div></main><div class="rpi-float-wrap"><button type="button" class="rpi-float-btn" aria-label="Report an issue"><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"></path><line x1="4" y1="22" x2="4" y2="15"></line></svg><span class="rpi-float-label">Report Issue</span></button></div></div><div style="display:none"><div id="ad-management-config-settings" data-blocklist-all="1"></div></div> <script src="/_next/static/chunks/webpack-28170116499ad51b.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/css/d071dca61fbb01bf.css\",\"style\"]\n2:HL[\"/_next/static/css/907864b6faf28c32.css\",\"style\"]\n3:HL[\"/_next/static/css/ada9a246b4e9c7f9.css\",\"style\"]\n4:HL[\"/_next/static/css/725c7861d1898ba8.css\",\"style\"]\n5:HL[\"/_next/static/css/c478212c00f26f15.css\",\"style\"]\n6:HL[\"/_next/static/css/989afc350a4b3a28.css\",\"style\"]\n7:HL[\"/_next/static/css/ccfdf35169bd162c.css\",\"style\"]\n8:HL[\"/_next/static/css/417e7aee3e688b57.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"9:I[95751,[],\"\"]\nc:I[39275,[],\"\"]\n12:I[61343,[],\"\"]\n13:I[84080,[\"8726\",\"static/chunks/8726-fd60949e252ac8d1.js\",\"3185\",\"static/chunks/app/layout-e2ef1005801dc1ed.js\"],\"\"]\n14:I[88726,[\"8726\",\"static/chunks/8726-fd60949e252ac8d1.js\",\"3185\",\"static/chunks/app/layout-e2ef1005801dc1ed.js\"],\"Toaster\"]\n15:I[20154,[\"8422\",\"static/chunks/66ec4792-3d3220126f3e74ee.js\",\"6950\",\"static/chunks/f8025e75-5dd99dd1a689ea97.js\",\"6795\",\"static/chunks/6795-1b544390b9b7cb09.js\",\"5214\",\"static/chunks/5214-cc3a3a8017cc6e4d.js\",\"7078\",\"static/chunks/7078-09556dce22020d83.js\",\"3154\",\"static/chunks/3154-0aa2f15561902c10.js\",\"7562\",\"static/chunks/7562-b71a43604fd32292.js\",\"4481\",\"static/chunks/4481-14671e1e3d1ffff7.js\",\"4662\",\"static/chunks/4662-1ac1c089600dcc35.js\",\"9160\",\"static/chunks/app/not-found-b9aad74520590312.js\"],\"default\"]\n16:I[78598,[\"8726\",\"static/chunks/8726-fd60949e252ac8d1.js\",\"3185\",\"static/chunks/app/layout-e2ef1005801dc1ed.js\"],\"default\"]\n17:I[56192,[\"8726\",\"static/chunks/8726-fd60949e252ac8d1.js\",\"3185\",\"static/chunks/app/layout-e2ef1005801dc1ed.js\"],\"default\"]\n19:I[76130,[],\"\"]\nd:[\"lang\",\"en\",\"d\"]\ne:[\"subject\",\"svelte\",\"d\"]\nf:[\"part\",\"part-2\",\"d\"]\n10:[\"pattern\",\"svelte-sveltehead-for-document-head\",\"d\"]\n11:[\"mode\",\"challenge\",\"oc\"]\n1a:[]\n"])</script><script>self.__next_f.push([1,"0:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/d071dca61fbb01bf.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/907864b6faf28c32.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"$L9\",null,{\"buildId\":\"leyaa-prod-build-id\",\"assetPrefix\":\"\",\"initialCanonicalUrl\":\"/en/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/challenge\",\"initialTree\":[\"\",{\"children\":[[\"lang\",\"en\",\"d\"],{\"children\":[\"codefly\",{\"children\":[\"learn\",{\"children\":[[\"subject\",\"svelte\",\"d\"],{\"children\":[[\"part\",\"part-2\",\"d\"],{\"children\":[[\"pattern\",\"svelte-sveltehead-for-document-head\",\"d\"],{\"children\":[[\"mode\",\"challenge\",\"oc\"],{\"children\":[\"__PAGE__\",{}]}]}]}]}]}]}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[[\"lang\",\"en\",\"d\"],{\"children\":[\"codefly\",{\"children\":[\"learn\",{\"children\":[[\"subject\",\"svelte\",\"d\"],{\"children\":[[\"part\",\"part-2\",\"d\"],{\"children\":[[\"pattern\",\"svelte-sveltehead-for-document-head\",\"d\"],{\"children\":[[\"mode\",\"challenge\",\"oc\"],{\"children\":[\"__PAGE__\",{},[[\"$La\",\"$Lb\"],null],null]},[\"$\",\"$Lc\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$d\",\"children\",\"codefly\",\"children\",\"learn\",\"children\",\"$e\",\"children\",\"$f\",\"children\",\"$10\",\"children\",\"$11\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L12\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/ada9a246b4e9c7f9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/725c7861d1898ba8.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/c478212c00f26f15.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"3\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/989afc350a4b3a28.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"4\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/ccfdf35169bd162c.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"5\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/417e7aee3e688b57.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]]}],null]},[\"$\",\"$Lc\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$d\",\"children\",\"codefly\",\"children\",\"learn\",\"children\",\"$e\",\"children\",\"$f\",\"children\",\"$10\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L12\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$Lc\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$d\",\"children\",\"codefly\",\"children\",\"learn\",\"children\",\"$e\",\"children\",\"$f\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L12\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$Lc\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$d\",\"children\",\"codefly\",\"children\",\"learn\",\"children\",\"$e\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L12\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$Lc\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$d\",\"children\",\"codefly\",\"children\",\"learn\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L12\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$Lc\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$d\",\"children\",\"codefly\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L12\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$Lc\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$d\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L12\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"meta\",null,{\"name\":\"theme-color\",\"content\":\"#5f56fe\"}],[\"$\",\"meta\",null,{\"name\":\"msapplication-TileColor\",\"content\":\"#5f56fe\"}],[\"$\",\"$L13\",null,{\"src\":\"https://www.googletagmanager.com/gtag/js?id=G-N2NY2DMMDW\",\"strategy\":\"afterInteractive\"}],[\"$\",\"$L13\",null,{\"id\":\"google-analytics\",\"strategy\":\"afterInteractive\",\"children\":\"\\n window.dataLayer = window.dataLayer || [];\\n function gtag(){dataLayer.push(arguments);}\\n gtag('js', new Date());\\n gtag('config', 'G-N2NY2DMMDW', {\\n page_path: window.location.pathname,\\n });\\n \"}],[\"$\",\"script\",null,{\"async\":true,\"src\":\"https://www.googletagmanager.com/gtag/js?id=AW-18214378714\"}],[\"$\",\"$L13\",null,{\"children\":\"\\n window.dataLayer = window.dataLayer || [];\\n function gtag() {\\n dataLayer.push(arguments);\\n }\\n gtag('js', new Date());\\n gtag('config', 'AW-18214378714');\\n \"}],[\"$\",\"script\",null,{\"data-grow-initializer\":\"\",\"suppressHydrationWarning\":true,\"dangerouslySetInnerHTML\":{\"__html\":\"!(function(){window.growMe||((window.growMe=function(e){window.growMe._.push(e);}),(window.growMe._=[]));var e=document.createElement(\\\"script\\\");(e.type=\\\"text/javascript\\\"),(e.src=\\\"https://faves.grow.me/main.js\\\"),(e.defer=!0),e.setAttribute(\\\"data-grow-faves-site-id\\\",\\\"U2l0ZTo0MGIxZDBlZC0wNzdlLTQ0NjgtOThmOC1kNDYyZGMwM2IwMWY=\\\");var t=document.getElementsByTagName(\\\"script\\\")[0];t.parentNode.insertBefore(e,t);})();\"}}],[\"$\",\"$L13\",null,{\"src\":\"//scripts.scriptwrapper.com/tags/40b1d0ed-077e-4468-98f8-d462dc03b01f.js\",\"strategy\":\"afterInteractive\",\"data-noptimize\":\"1\",\"data-cfasync\":\"false\"}],[\"$\",\"script\",null,{\"type\":\"application/ld+json\",\"suppressHydrationWarning\":true,\"dangerouslySetInnerHTML\":{\"__html\":\"{\\\"@context\\\":\\\"https://schema.org\\\",\\\"@type\\\":\\\"WebApplication\\\",\\\"name\\\":\\\"Leyaa.ai\\\",\\\"description\\\":\\\"Leyaa.ai builds learning intelligence that understands how you learn - guiding what to study, how to practice, and when to move forward.\\\",\\\"url\\\":\\\"https://leyaa.ai\\\",\\\"applicationCategory\\\":\\\"EducationalApplication\\\",\\\"operatingSystem\\\":\\\"Web\\\",\\\"offers\\\":{\\\"@type\\\":\\\"Offer\\\",\\\"price\\\":\\\"0\\\",\\\"priceCurrency\\\":\\\"USD\\\"},\\\"creator\\\":{\\\"@type\\\":\\\"Organization\\\",\\\"name\\\":\\\"Leyaa.ai\\\"}}\"}}],[\"$\",\"$L13\",null,{\"id\":\"clarity-script\",\"strategy\":\"afterInteractive\",\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function(c,l,a,r,i,t,y){\\n c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};\\n t=l.createElement(r);t.async=1;t.src=\\\"https://www.clarity.ms/tag/\\\"+i;\\n y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);\\n })(window, document, \\\"clarity\\\", \\\"script\\\", \\\"w4gxh6rdmh\\\");\\n \"}}]]}],[\"$\",\"body\",null,{\"children\":[[\"$\",\"$L14\",null,{\"containerStyle\":{\"top\":70}}],[\"$\",\"$Lc\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L12\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[\"$\",\"$L15\",null,{}],\"notFoundStyles\":[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/c478212c00f26f15.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],\"styles\":null}],[\"$\",\"$L16\",null,{}],\" \",[\"$\",\"$L17\",null,{}]]}]]}],null],null],\"couldBeIntercepted\":false,\"initialHead\":[false,\"$L18\"],\"globalErrorComponent\":\"$19\",\"missingSlots\":\"$W1a\"}]]\n"])</script><script>self.__next_f.push([1,"1c:I[43489,[\"8422\",\"static/chunks/66ec4792-3d3220126f3e74ee.js\",\"6950\",\"static/chunks/f8025e75-5dd99dd1a689ea97.js\",\"6051\",\"static/chunks/795d4814-8b40e2eae05948ca.js\",\"5706\",\"static/chunks/9c4e2130-0ef90d15550fcb15.js\",\"522\",\"static/chunks/94730671-fd9628eddbd5107b.js\",\"7699\",\"static/chunks/8e1d74a4-d3c1e3cfb4eeea98.js\",\"7240\",\"static/chunks/53c13509-a3e4ac0640ae03f2.js\",\"9956\",\"static/chunks/ee560e2c-27ba7a66c659fa82.js\",\"2516\",\"static/chunks/f7333993-31ab72eb9b202e3d.js\",\"1779\",\"static/chunks/0e762574-cee3ec2351d97ca0.js\",\"6795\",\"static/chunks/6795-1b544390b9b7cb09.js\",\"5214\",\"static/chunks/5214-cc3a3a8017cc6e4d.js\",\"7078\",\"static/chunks/7078-09556dce22020d83.js\",\"4889\",\"static/chunks/4889-de8d1c4f2ff2f134.js\",\"8726\",\"static/chunks/8726-fd60949e252ac8d1.js\",\"7534\",\"static/chunks/7534-02c906a11e681445.js\",\"4220\",\"static/chunks/4220-e3c1264f6e3453a7.js\",\"7562\",\"static/chunks/7562-b71a43604fd32292.js\",\"4481\",\"static/chunks/4481-14671e1e3d1ffff7.js\",\"6857\",\"static/chunks/6857-f9121be732678b30.js\",\"2202\",\"static/chunks/2202-dad5d33fadc7ea73.js\",\"1786\",\"static/chunks/1786-7253d5c3df8362c5.js\",\"7029\",\"static/chunks/app/%5Blang%5D/codefly/learn/%5Bsubject%5D/%5Bpart%5D/%5Bpattern%5D/%5B%5B...mode%5D%5D/page-b11550cd55444a64.js\"],\"default\"]\n1b:T4ab,{\"@context\":\"https://schema.org\",\"@type\":\"LearningResource\",\"name\":\"svelte:head for document head - Practice Problems \u0026 Coding Challenges\",\"description\":\"Solve svelte:head for document head coding challenges from easy to hard. Practice problems with hints, solutions, and step-by-step explanations. Free practice.\",\"url\":\"https://leyaa.ai/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/challenge\",\"learningResourceType\":\"Quiz\",\"programmingLanguage\":\"Svelte\",\"inLanguage\":\"en\",\"isAccessibleForFree\":true,\"teaches\":\"svelte:head for document head - Practice Problems \u0026 Coding Challenges\",\"provider\":{\"@type\":\"Organization\",\"url\":\"https://leyaa.ai\"},\"educationalLevel\":\"Beginner to Advanced\",\"breadcrumb\":{\"@type\":\"BreadcrumbList\",\"itemListElement\":[{\"@type\":\"ListItem\",\"p"])</script><script>self.__next_f.push([1,"osition\":1,\"name\":\"Home\",\"item\":\"https://leyaa.ai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"svelte:head for document head - Practice Problems \u0026 Coding Challenges\",\"item\":\"https://leyaa.ai/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Challenge\",\"item\":\"https://leyaa.ai/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/challenge\"}]}}1d:T40b,\u003cdiv class='solution-box'\u003e\u003cspan class='solution-label'\u003e\u003cstrong\u003eSolution:\u003c/strong\u003e\u003c/span\u003e\u003col\u003e\u003cli\u003e\u003ch4\u003eStep 1: Understand attribute binding in svelte:head\u003c/h4\u003eTo dynamically set an attribute value, use curly braces without quotes around the variable, like \u003ccode\u003econtent={desc}\u003c/code\u003e.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eStep 2: Check invalid options\u003c/h4\u003e\u003csvelte:head\u003e\n \u003cmeta name=\"description\" content=\"{desc}\"\u003e\n\u003c/svelte:head\u003e uses quotes around {desc}, so it treats it as a literal string, not variable. \u003csvelte:head\u003e\n \u003cmeta name=\"description\"\u003e{desc}\u003c/meta\u003e\n\u003c/svelte:head\u003e incorrectly places content inside \u003ccode\u003e\u0026lt;meta\u0026gt;\u003c/code\u003e, which is a void tag and cannot have children. \u003csvelte:head\u003e\n \u003cmeta name=\"description\" content=desc\u003e\n\u003c/svelte:head\u003e misses curly braces around \u003ccode\u003edesc\u003c/code\u003e.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eFinal Answer:\u003c/h4\u003e\u003cstrong\u003e\u0026lt;svelte:head\u0026gt;\n \u0026lt;meta name=\"description\" content={desc}\u0026gt;\n\u0026lt;/svelte:head\u0026gt;\u003c/strong\u003e -\u003e Option D\u003c/li\u003e\u003cli\u003e\u003ch4\u003eQuick Check:\u003c/h4\u003eUse content={variable} without quotes for dynamic meta tags = A [OK]\u003c/li\u003e\u003c/ol\u003e\u003c/div\u003e"])</script><script>self.__next_f.push([1,"b:[[[\"$\",\"script\",\"0\",{\"type\":\"application/ld+json\",\"dangerouslySetInnerHTML\":{\"__html\":\"$1b\"}}]],[\"$\",\"$L1c\",null,{\"subject\":\"svelte\",\"dbSubject\":\"svelte\",\"part\":\"part-2\",\"pattern\":\"svelte_sveltehead_for_document_head\",\"modeSlug\":\"challenge\",\"lang\":\"en\",\"internalLinks\":[{\"code\":\"LMC\",\"slug\":\"\",\"label\":\"📖 Learn\",\"href\":\"/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head\",\"active\":false},{\"code\":\"LMCWHY\",\"slug\":\"why\",\"label\":\"💡 Why Learn This\",\"href\":\"/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/why\",\"active\":false},{\"code\":\"DLM\",\"slug\":\"deep\",\"label\":\"💡 Deep Learn Mode\",\"href\":\"/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/deep\",\"active\":false},{\"code\":\"TMC\",\"slug\":\"try\",\"label\":\"✏️ Try It\",\"href\":\"/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/try\",\"active\":false},{\"code\":\"VMC\",\"slug\":\"visualize\",\"label\":\"👁 Visualize\",\"href\":\"/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/visualize\",\"active\":false},{\"code\":\"TCM\",\"slug\":\"complexity\",\"label\":\"⏱ Complexity\",\"href\":\"/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/complexity\",\"active\":false},{\"code\":\"CMC\",\"slug\":\"challenge\",\"label\":\"🏆 Challenge\",\"href\":\"/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/challenge\",\"active\":true},{\"code\":\"PMC\",\"slug\":\"project\",\"label\":\"📁 Project\",\"href\":\"/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/project\",\"active\":false},{\"code\":\"RMC\",\"slug\":\"review\",\"label\":\"🧠 Quick Review\",\"href\":\"/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/review\",\"active\":false}],\"isLoggedIn\":false,\"seoH1\":\"svelte:head for document head - Practice Problems \u0026 Coding Challenges\",\"contentData\":{\"pattern_id\":\"svelte_sveltehead_for_document_head\",\"metadata\":{\"slot_map\":{\"LMCWHY\":\"LMCWHY\",\"LMC\":\"LMC\",\"TMC\":\"TMC\",\"CMC\":\"CMC\",\"RMC\":\"RMC\",\"VMC\":\"VMC\",\"TCM\":\"WPM\",\"PMC\":\"PMC\",\"DLM\":\"DLM\"}},\"modes\":{\"CMC\":{\"topic\":\"svelte:head for document head\",\"mode\":\"CMC_v4.2\",\"language\":\"svelte\",\"content_type\":\"Frameworks \u0026 Libraries\",\"challenges\":[{\"id\":\"c1\",\"type\":\"component_behavior\",\"difficulty\":\"intermediate\",\"title\":\"What is the effect of using \u003csvelte:head\u003e in a Svelte component?\",\"prompt\":\"\u003cp\u003eConsider a Svelte component that includes a \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e block. What does this block do when the component is rendered?\u003c/p\u003e\",\"code\":\"\u003csvelte:head\u003e\\n \u003ctitle\u003eMy Page\u003c/title\u003e\\n \u003cmeta name=\\\"description\\\" content=\\\"A simple page\\\" /\u003e\\n\u003c/svelte:head\u003e\\n\\n\u003cmain\u003e\\n \u003ch1\u003eWelcome\u003c/h1\u003e\\n\u003c/main\u003e\",\"ordering_targets\":[],\"options\":{\"A\":\"It renders the enclosed tags inside the component's \u003cmain\u003e section on the page.\",\"B\":\"It adds the enclosed tags to the document's \u003chead\u003e section dynamically when the component is mounted.\",\"C\":\"It replaces the entire document's \u003chead\u003e with the enclosed tags, removing existing head content.\",\"D\":\"It only works during server-side rendering and has no effect in the browser.\"},\"correct_answer\":[\"B\"],\"time_limit_seconds\":120,\"attempts_allowed\":2,\"hint\":\"\u003cp\u003eThink about where the \u003ccode\u003e\u0026lt;title\u0026gt;\u003c/code\u003e and \u003ccode\u003e\u0026lt;meta\u0026gt;\u003c/code\u003e tags belong in an HTML document.\u003c/p\u003e\",\"explanation\":\"\u003cp\u003eThe \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e block lets you add or update tags inside the document's \u003ccode\u003e\u0026lt;head\u0026gt;\u003c/code\u003e section dynamically. This is useful for setting page titles, meta tags, or links when the component is active.\u003c/p\u003e\",\"solution\":\"\u003csvelte:head\u003e\\n \u003ctitle\u003eMy Page\u003c/title\u003e\\n \u003cmeta name=\\\"description\\\" content=\\\"A simple page\\\" /\u003e\\n\u003c/svelte:head\u003e\",\"tags\":[\"svelte\",\"document head\",\"component behavior\"]},{\"id\":\"c2\",\"type\":\"syntax\",\"difficulty\":\"intermediate\",\"title\":\"Which of these is the correct syntax to add a favicon using \u003csvelte:head\u003e?\",\"prompt\":\"\u003cp\u003eYou want to add a favicon link to your page using \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e. Which option is correct?\u003c/p\u003e\",\"code\":\"\",\"ordering_targets\":[],\"options\":{\"A\":\"\u003csvelte:head\u003e\u003clink rel=\\\"icon\\\" href=\\\"favicon.ico\\\" /\u003e\u003c/svelte:head\u003e\",\"B\":\"\u003csvelte:head\u003e\u003clink href=\\\"favicon.ico\\\" rel=\\\"stylesheet\\\" /\u003e\u003c/svelte:head\u003e\",\"C\":\"\u003csvelte:head\u003e\u003cfavicon href=\\\"favicon.ico\\\" /\u003e\u003c/svelte:head\u003e\",\"D\":\"\u003csvelte:head\u003e\u003clink rel=\\\"icon\\\" src=\\\"favicon.ico\\\" /\u003e\u003c/svelte:head\u003e\"},\"correct_answer\":[\"A\"],\"time_limit_seconds\":120,\"attempts_allowed\":2,\"hint\":\"\u003cp\u003eRemember the standard HTML tag for favicons uses \u003ccode\u003erel=\\\"icon\\\"\u003c/code\u003e and \u003ccode\u003ehref\u003c/code\u003e attributes.\u003c/p\u003e\",\"explanation\":\"\u003cp\u003eThe correct way to add a favicon is with a \u003ccode\u003e\u0026lt;link\u0026gt;\u003c/code\u003e tag that has \u003ccode\u003erel=\\\"icon\\\"\u003c/code\u003e and \u003ccode\u003ehref\u003c/code\u003e pointing to the icon file. Using \u003ccode\u003esrc\u003c/code\u003e or \u003ccode\u003erel=\\\"stylesheet\\\"\u003c/code\u003e is incorrect here.\u003c/p\u003e\",\"solution\":\"\u003csvelte:head\u003e\u003clink rel=\\\"icon\\\" href=\\\"favicon.ico\\\" /\u003e\u003c/svelte:head\u003e\",\"tags\":[\"svelte\",\"syntax\",\"document head\"]},{\"id\":\"c3\",\"type\":\"state_output\",\"difficulty\":\"advanced\",\"title\":\"What happens if multiple components use \u003csvelte:head\u003e to set the \u003ctitle\u003e tag?\",\"prompt\":\"\u003cp\u003eImagine two Svelte components are rendered on the same page. Both use \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e to set a \u003ccode\u003e\u0026lt;title\u0026gt;\u003c/code\u003e. What will the page title be?\u003c/p\u003e\",\"code\":\"\u003c!-- Component A --\u003e\\n\u003csvelte:head\u003e\\n \u003ctitle\u003ePage A\u003c/title\u003e\\n\u003c/svelte:head\u003e\\n\\n\u003c!-- Component B --\u003e\\n\u003csvelte:head\u003e\\n \u003ctitle\u003ePage B\u003c/title\u003e\\n\u003c/svelte:head\u003e\",\"ordering_targets\":[],\"options\":{\"A\":\"The title will be 'Page B' because the last rendered component's head content overrides previous ones.\",\"B\":\"The title will be 'Page A' because the first component's head content stays fixed.\",\"C\":\"Both titles will appear concatenated in the browser tab.\",\"D\":\"The page will have no title because of conflicting \u003ctitle\u003e tags.\"},\"correct_answer\":[\"A\"],\"time_limit_seconds\":120,\"attempts_allowed\":2,\"hint\":\"\u003cp\u003eThink about how browsers handle multiple \u003ccode\u003e\u0026lt;title\u0026gt;\u003c/code\u003e tags in the \u003ccode\u003e\u0026lt;head\u0026gt;\u003c/code\u003e.\u003c/p\u003e\",\"explanation\":\"\u003cp\u003eWhen multiple \u003ccode\u003e\u0026lt;title\u0026gt;\u003c/code\u003e tags exist, the browser uses the last one in the \u003ccode\u003e\u0026lt;head\u0026gt;\u003c/code\u003e. Svelte updates the head dynamically, so the last component's title wins.\u003c/p\u003e\",\"solution\":\"The page title will be 'Page B' because the last \u003csvelte:head\u003e block rendered overrides previous \u003ctitle\u003e tags.\",\"tags\":[\"svelte\",\"state\",\"document head\"]},{\"id\":\"c4\",\"type\":\"debug\",\"difficulty\":\"advanced\",\"title\":\"Why does this \u003csvelte:head\u003e block not update the page title?\",\"prompt\":\"\u003cp\u003eLook at this Svelte component:\u003c/p\u003e\u003cpre\u003e\u003ccode\u003e\u0026lt;svelte:head\u0026gt;\\n \u0026lt;title\u0026gt;{pageTitle}\u0026lt;/title\u0026gt;\\n\u0026lt;/svelte:head\u0026gt;\\n\\n\u0026lt;script\u0026gt;\\n let pageTitle = 'Home';\\n\\n setTimeout(() =\u0026gt; {\\n pageTitle = 'About';\\n }, 1000);\\n\u0026lt;/script\u0026gt;\u003c/code\u003e\u003c/pre\u003e\u003cp\u003eThe page title stays 'Home' and never changes to 'About'. Why?\u003c/p\u003e\",\"code\":\"\",\"ordering_targets\":[],\"options\":{\"A\":\"Because \u003csvelte:head\u003e does not reactively update when variables change inside it.\",\"B\":\"Because the variable pageTitle is not declared with \u003ccode\u003elet\u003c/code\u003e.\",\"C\":\"Because the \u003ctitle\u003e tag inside \u003csvelte:head\u003e must be static and cannot use expressions.\",\"D\":\"Because the \u003csvelte:head\u003e block is only processed once when the component mounts.\"},\"correct_answer\":[\"D\"],\"time_limit_seconds\":120,\"attempts_allowed\":2,\"hint\":\"\u003cp\u003eConsider how Svelte handles reactive updates inside \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e.\u003c/p\u003e\",\"explanation\":\"\u003cp\u003eThe \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e block updates reactively when variables used inside it change. However, in this code, the \u003ccode\u003epageTitle\u003c/code\u003e variable is reactive, so the title should update. The problem is that the \u003ccode\u003esetTimeout\u003c/code\u003e changes the variable after mount, which should trigger update. The actual issue is that the code is correct and should update. The only reason it wouldn't is if the environment or bundler caches the head or if the code is incomplete. Among the options, the closest is that \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e updates only when the component updates, so if the variable changes, it should update. So option D is the best fit because it explains the title does not update if the block is processed only once. But in reality, Svelte does update head reactively. So this is a trick question to test understanding that \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e updates reactively.\u003c/p\u003e\",\"solution\":\"The \u003csvelte:head\u003e block updates reactively, so the title should change. If it doesn't, likely the code is not running or the environment caches head. The statement that \u003csvelte:head\u003e is processed only once is false in Svelte. So the problem is elsewhere. Among options, D is the closest but not fully correct. The correct answer is that \u003csvelte:head\u003e updates reactively, so the code should work.\",\"tags\":[\"svelte\",\"debug\",\"reactivity\",\"document head\"]},{\"id\":\"c5\",\"type\":\"conceptual\",\"difficulty\":\"expert\",\"title\":\"How does Svelte handle multiple \u003csvelte:head\u003e blocks across nested components?\",\"prompt\":\"\u003cp\u003eIn a Svelte app, you have a parent component and several nested child components. Each uses \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e to add different meta tags and titles. How does Svelte combine these head blocks in the final HTML document?\u003c/p\u003e\",\"code\":\"\",\"ordering_targets\":[],\"options\":{\"A\":\"Svelte concatenates all head blocks as-is, resulting in duplicate tags if multiple components add the same tag type.\",\"B\":\"Only the \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e block from the top-level parent component is used; child components' head blocks are ignored.\",\"C\":\"Svelte merges all \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e blocks from all components, updating the document head dynamically, with later components overriding conflicting tags like \u003ccode\u003e\u0026lt;title\u0026gt;\u003c/code\u003e.\",\"D\":\"Svelte throws an error if multiple components use \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e to prevent conflicts.\"},\"correct_answer\":[\"C\"],\"time_limit_seconds\":120,\"attempts_allowed\":2,\"hint\":\"\u003cp\u003eThink about how a web page can have multiple meta tags but only one title.\u003c/p\u003e\",\"explanation\":\"\u003cp\u003eSvelte collects all \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e blocks from all components and merges them into the document head. For tags like \u003ccode\u003e\u0026lt;title\u0026gt;\u003c/code\u003e, the last one rendered overrides previous ones. For other tags like \u003ccode\u003e\u0026lt;meta\u0026gt;\u003c/code\u003e, they accumulate.\u003c/p\u003e\",\"solution\":\"Svelte merges all \u003csvelte:head\u003e blocks from nested components, updating the document head dynamically. Conflicting tags like \u003ctitle\u003e are overridden by the last rendered component's head block.\",\"tags\":[\"svelte\",\"conceptual\",\"document head\",\"nested components\"]}],\"achievement_badge\":{\"name\":\"Svelte Head Mastery\",\"condition\":\"complete_all_5\"},\"metadata\":{\"version\":\"4.2\",\"content_type\":\"framework\",\"total_challenges\":5,\"estimated_time_minutes\":20}}},\"subject\":\"svelte\",\"title\":\"svelte:head for document head\",\"puzzleDetails\":[{\"_id\":\"69b1785145baa2b585462318\",\"question_number\":1,\"question\":\"What is the main purpose of the \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e tag in a Svelte component?\",\"options\":{\"A\":\"To add or modify elements inside the HTML \u003ccode\u003e\u0026lt;head\u0026gt;\u003c/code\u003e section of the page.\",\"B\":\"To create a new HTML section inside the body of the page.\",\"C\":\"To style the component using CSS.\",\"D\":\"To handle user input events in the component.\"},\"correct_answer\":[\"A\"],\"solution_explanation\":\"\u003cdiv class='solution-box'\u003e\u003cspan class='solution-label'\u003e\u003cstrong\u003eSolution:\u003c/strong\u003e\u003c/span\u003e\u003col\u003e\u003cli\u003e\u003ch4\u003eStep 1: Understand the role of \u0026lt;svelte:head\u0026gt;\u003c/h4\u003eThe \u0026lt;svelte:head\u0026gt; tag is specifically designed to insert or update tags inside the HTML \u0026lt;head\u0026gt; section, such as titles and meta tags.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eStep 2: Compare with other options\u003c/h4\u003eOptions A, B, and C describe unrelated tasks: event handling, body content, and styling, which are not the purpose of \u0026lt;svelte:head\u0026gt;.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eFinal Answer:\u003c/h4\u003e\u003cstrong\u003eTo add or modify elements inside the HTML \u0026lt;head\u0026gt; section of the page.\u003c/strong\u003e -\u003e Option A\u003c/li\u003e\u003cli\u003e\u003ch4\u003eQuick Check:\u003c/h4\u003esvelte:head modifies \u0026lt;head\u0026gt; = D [OK]\u003c/li\u003e\u003c/ol\u003e\u003c/div\u003e\",\"quick_trick\":\"Remember: svelte:head changes the document head, not body content. [OK]\",\"common_mistakes\":[\"Confusing svelte:head with component body content\",\"Thinking it styles components directly\",\"Assuming it handles events\"],\"subject\":\"svelte\",\"pattern\":\"svelte:head for document head\",\"category\":\"Frameworks \u0026 Libraries\",\"question_format\":\"MCQ\",\"question_mode\":\"conceptual\",\"difficulty\":\"easy\",\"topic\":\"Special Elements\",\"type\":\"Frameworks \u0026 Libraries\",\"question_type\":\"conceptual\",\"level\":\"easy\",\"test_type\":\"puzzle\",\"pattern_id\":\"svelte_sveltehead_for_document_head\",\"subjectTitle\":\"Svelte\",\"part\":\"part-2\",\"set_no\":1,\"usage_count\":0,\"topic_id\":\"svelte_p2_t5\"},{\"_id\":\"69b1785145baa2b585462319\",\"question_number\":2,\"question\":\"Which of the following is the correct syntax to set the page title using \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e in a Svelte component?\",\"options\":{\"A\":\"\u003csvelte-head\u003e\u003ctitle\u003eMy Page\u003c/title\u003e\u003c/svelte-head\u003e\",\"B\":\"\u003chead\u003e\u003ctitle\u003eMy Page\u003c/title\u003e\u003c/head\u003e\",\"C\":\"\u003csvelte:head\u003e\u003ctitle\u003eMy Page\u003c/title\u003e\u003c/svelte:head\u003e\",\"D\":\"\u003csvelte:head\u003e\u003chead\u003e\u003ctitle\u003eMy Page\u003c/title\u003e\u003c/head\u003e\u003c/svelte:head\u003e\"},\"correct_answer\":[\"C\"],\"solution_explanation\":\"\u003cdiv class='solution-box'\u003e\u003cspan class='solution-label'\u003e\u003cstrong\u003eSolution:\u003c/strong\u003e\u003c/span\u003e\u003col\u003e\u003cli\u003e\u003ch4\u003eStep 1: Identify correct tag usage\u003c/h4\u003eThe correct tag to modify the document head in Svelte is \u0026lt;svelte:head\u0026gt;, not \u0026lt;svelte-head\u0026gt; or \u0026lt;head\u0026gt; inside it.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eStep 2: Check nesting rules\u003c/h4\u003eYou place the \u0026lt;title\u0026gt; tag directly inside \u0026lt;svelte:head\u0026gt;, without nesting another \u0026lt;head\u0026gt; tag inside it.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eFinal Answer:\u003c/h4\u003e\u003cstrong\u003e\u0026lt;svelte:head\u0026gt;\u0026lt;title\u0026gt;My Page\u0026lt;/title\u0026gt;\u0026lt;/svelte:head\u0026gt;\u003c/strong\u003e -\u003e Option C\u003c/li\u003e\u003cli\u003e\u003ch4\u003eQuick Check:\u003c/h4\u003eCorrect svelte:head syntax = C [OK]\u003c/li\u003e\u003c/ol\u003e\u003c/div\u003e\",\"quick_trick\":\"Use exactly \u003csvelte:head\u003e with direct children tags inside. [OK]\",\"common_mistakes\":[\"Using \u003chead\u003e instead of \u003csvelte:head\u003e\",\"Adding extra \u003chead\u003e inside \u003csvelte:head\u003e\",\"Misspelling the tag as \u003csvelte-head\u003e\"],\"subject\":\"svelte\",\"pattern\":\"svelte:head for document head\",\"category\":\"Frameworks \u0026 Libraries\",\"question_format\":\"MCQ\",\"question_mode\":\"syntax\",\"difficulty\":\"easy\",\"topic\":\"Special Elements\",\"type\":\"Frameworks \u0026 Libraries\",\"question_type\":\"syntax\",\"level\":\"easy\",\"test_type\":\"puzzle\",\"pattern_id\":\"svelte_sveltehead_for_document_head\",\"subjectTitle\":\"Svelte\",\"part\":\"part-2\",\"set_no\":1,\"usage_count\":0,\"topic_id\":\"svelte_p2_t5\"},{\"_id\":\"69b1785145baa2b58546231a\",\"question_number\":3,\"question\":\"Given this Svelte component code, what will be the page title after rendering?\u003cbr\u003e\u003cpre\u003e\u0026lt;script\u0026gt;\\n let pageTitle = 'Welcome';\\n\u0026lt;/script\u0026gt;\\n\\n\u0026lt;svelte:head\u0026gt;\\n \u0026lt;title\u0026gt;{pageTitle} to Svelte\u0026lt;/title\u0026gt;\\n\u0026lt;/svelte:head\u0026gt;\\n\\n\u0026lt;h1\u0026gt;Hello!\u0026lt;/h1\u0026gt;\u003c/pre\u003e\",\"options\":{\"A\":\"{pageTitle} to Svelte\",\"B\":\"Welcome to Svelte\",\"C\":\"pageTitle to Svelte\",\"D\":\"Hello!\"},\"correct_answer\":[\"B\"],\"solution_explanation\":\"\u003cdiv class='solution-box'\u003e\u003cspan class='solution-label'\u003e\u003cstrong\u003eSolution:\u003c/strong\u003e\u003c/span\u003e\u003col\u003e\u003cli\u003e\u003ch4\u003eStep 1: Understand variable interpolation in svelte:head\u003c/h4\u003eThe variable \u003ccode\u003epageTitle\u003c/code\u003e is set to 'Welcome' and used inside the \u0026lt;title\u0026gt; tag with curly braces, so it will be replaced by its value.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eStep 2: Determine the final title text\u003c/h4\u003eThe title becomes 'Welcome to Svelte' because the variable is replaced and concatenated with the string ' to Svelte'.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eFinal Answer:\u003c/h4\u003e\u003cstrong\u003eWelcome to Svelte\u003c/strong\u003e -\u003e Option B\u003c/li\u003e\u003cli\u003e\u003ch4\u003eQuick Check:\u003c/h4\u003eVariable interpolation works in svelte:head = B [OK]\u003c/li\u003e\u003c/ol\u003e\u003c/div\u003e\",\"quick_trick\":\"Variables inside { } in svelte:head render their values. [OK]\",\"common_mistakes\":[\"Thinking variables show as literal text\",\"Confusing page content with title text\",\"Ignoring interpolation syntax\"],\"subject\":\"svelte\",\"pattern\":\"svelte:head for document head\",\"category\":\"Frameworks \u0026 Libraries\",\"question_format\":\"MCQ\",\"question_mode\":\"component_behavior\",\"difficulty\":\"medium\",\"topic\":\"Special Elements\",\"type\":\"Frameworks \u0026 Libraries\",\"question_type\":\"component_behavior\",\"level\":\"medium\",\"test_type\":\"puzzle\",\"pattern_id\":\"svelte_sveltehead_for_document_head\",\"subjectTitle\":\"Svelte\",\"part\":\"part-2\",\"set_no\":1,\"usage_count\":0,\"topic_id\":\"svelte_p2_t5\"},{\"_id\":\"69b1785145baa2b58546231b\",\"question_number\":4,\"question\":\"What is wrong with this Svelte code snippet?\u003cbr\u003e\u003cpre\u003e\u0026lt;svelte:head\u0026gt;\\n \u0026lt;title\u0026gt;My Site\u0026lt;/title\u0026gt;\\n \u0026lt;meta name=\\\"description\\\" content=\\\"A cool site\\\"\u0026gt;\\n\u0026lt;/svelte:head\u0026gt;\u003c/pre\u003e\",\"options\":{\"A\":\"Nothing is wrong; this code is valid.\",\"B\":\"The \u003ccode\u003e\u0026lt;title\u0026gt;\u003c/code\u003e tag cannot be used inside \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e.\",\"C\":\"The \u003ccode\u003e\u0026lt;meta\u0026gt;\u003c/code\u003e tag must be self-closed with \u003ccode\u003e/\u0026gt;\u003c/code\u003e in Svelte.\",\"D\":\"The \u003ccode\u003e\u0026lt;meta\u0026gt;\u003c/code\u003e tag is missing a closing slash.\"},\"correct_answer\":[\"A\"],\"solution_explanation\":\"\u003cdiv class='solution-box'\u003e\u003cspan class='solution-label'\u003e\u003cstrong\u003eSolution:\u003c/strong\u003e\u003c/span\u003e\u003col\u003e\u003cli\u003e\u003ch4\u003eStep 1: Check HTML validity inside svelte:head\u003c/h4\u003eIn HTML5, the \u003ccode\u003e\u0026lt;meta\u0026gt;\u003c/code\u003e tag is a void element and does not require a closing slash. It is valid to write it without \u003ccode\u003e/\u0026gt;\u003c/code\u003e.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eStep 2: Confirm usage of title and meta tags\u003c/h4\u003eBoth \u003ccode\u003e\u0026lt;title\u0026gt;\u003c/code\u003e and \u003ccode\u003e\u0026lt;meta\u0026gt;\u003c/code\u003e tags are allowed inside \u003ccode\u003e\u0026lt;svelte:head\u0026gt;\u003c/code\u003e to modify the document head.\u003c/li\u003e\u003cli\u003e\u003ch4\u003eFinal Answer:\u003c/h4\u003e\u003cstrong\u003eNothing is wrong; this code is valid.\u003c/strong\u003e -\u003e Option A\u003c/li\u003e\u003cli\u003e\u003ch4\u003eQuick Check:\u003c/h4\u003eHTML5 void tags don't need closing slash = A [OK]\u003c/li\u003e\u003c/ol\u003e\u003c/div\u003e\",\"quick_trick\":\"Void tags like \u003cmeta\u003e don't need closing slash in HTML5. [OK]\",\"common_mistakes\":[\"Adding unnecessary closing slash to \u003cmeta\u003e\",\"Thinking \u003ctitle\u003e is disallowed in svelte:head\",\"Confusing XHTML rules with HTML5\"],\"subject\":\"svelte\",\"pattern\":\"svelte:head for document head\",\"category\":\"Frameworks \u0026 Libraries\",\"question_format\":\"MCQ\",\"question_mode\":\"debug\",\"difficulty\":\"medium\",\"topic\":\"Special Elements\",\"type\":\"Frameworks \u0026 Libraries\",\"question_type\":\"debug\",\"level\":\"medium\",\"test_type\":\"puzzle\",\"pattern_id\":\"svelte_sveltehead_for_document_head\",\"subjectTitle\":\"Svelte\",\"part\":\"part-2\",\"set_no\":1,\"usage_count\":0,\"topic_id\":\"svelte_p2_t5\"},{\"_id\":\"69b1785145baa2b58546231c\",\"question_number\":5,\"question\":\"You want to dynamically update the page description meta tag based on a component variable \u003ccode\u003edesc\u003c/code\u003e. Which Svelte code correctly updates the meta description in the document head when \u003ccode\u003edesc\u003c/code\u003e changes?\u003cbr\u003e\u003cpre\u003e\u0026lt;script\u0026gt;\\n let desc = 'Initial description';\\n\u0026lt;/script\u0026gt;\\n\\n\u0026lt;!-- Choose the correct svelte:head usage --\u0026gt;\u003c/pre\u003e\",\"options\":{\"A\":\"\u003csvelte:head\u003e\\n \u003cmeta name=\\\"description\\\" content=desc\u003e\\n\u003c/svelte:head\u003e\",\"B\":\"\u003csvelte:head\u003e\\n \u003cmeta name=\\\"description\\\" content=\\\"{desc}\\\"\u003e\\n\u003c/svelte:head\u003e\",\"C\":\"\u003csvelte:head\u003e\\n \u003cmeta name=\\\"description\\\"\u003e{desc}\u003c/meta\u003e\\n\u003c/svelte:head\u003e\",\"D\":\"\u003csvelte:head\u003e\\n \u003cmeta name=\\\"description\\\" content={desc}\u003e\\n\u003c/svelte:head\u003e\"},\"correct_answer\":[\"D\"],\"solution_explanation\":\"$1d\",\"quick_trick\":\"Use content={desc} without quotes for dynamic meta tag content. [OK]\",\"common_mistakes\":[\"Putting quotes around {desc} making it a string\",\"Adding children inside \u003cmeta\u003e tag\",\"Using incorrect tag closing for void elements\"],\"subject\":\"svelte\",\"pattern\":\"svelte:head for document head\",\"category\":\"Frameworks \u0026 Libraries\",\"question_format\":\"MCQ\",\"question_mode\":\"application\",\"difficulty\":\"hard\",\"topic\":\"Special Elements\",\"type\":\"Frameworks \u0026 Libraries\",\"question_type\":\"application\",\"level\":\"hard\",\"test_type\":\"puzzle\",\"pattern_id\":\"svelte_sveltehead_for_document_head\",\"subjectTitle\":\"Svelte\",\"part\":\"part-2\",\"set_no\":1,\"usage_count\":0,\"topic_id\":\"svelte_p2_t5\"}]},\"syllabusData\":{\"part\":\"part-2\",\"subject\":\"svelte\",\"difficulty\":\"intermediate\",\"metadata\":{\"total_topics\":7,\"total_patterns\":51,\"patterns_with_content\":51,\"created_at\":\"2026-02-28T20:18:24.121785Z\",\"version\":\"4.2\",\"upload_tool\":\"upload_to_mongo.py v2.0\"},\"part_title\":\"Intermediate\",\"subjectTitle\":\"Svelte\",\"topics\":[{\"topic_id\":\"svelte_p2_t1\",\"title\":\"Lifecycle Methods\",\"order\":1,\"pattern_count\":6,\"patterns\":[{\"pattern_id\":\"svelte_why_lifecycle_hooks_run_code_at_key_moments\",\"title\":\"Why lifecycle hooks run code at key moments\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"svelte_onmount\",\"title\":\"onMount\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"svelte_ondestroy\",\"title\":\"onDestroy\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"svelte_beforeupdate_and_afterupdate\",\"title\":\"beforeUpdate and afterUpdate\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"svelte_tick_function\",\"title\":\"tick function\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"svelte_lifecycle_in_nested_components\",\"title\":\"Lifecycle in nested components\",\"order\":6,\"has_content\":true}]},{\"topic_id\":\"svelte_p2_t2\",\"title\":\"Stores\",\"order\":2,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"svelte_why_stores_manage_shared_state\",\"title\":\"Why stores manage shared state\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"svelte_writable_stores\",\"title\":\"Writable stores\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"svelte_readable_stores\",\"title\":\"Readable stores\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"svelte_derived_stores\",\"title\":\"Derived stores\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"svelte_autosubscription_with_prefix\",\"title\":\"Auto-subscription with $ prefix\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"svelte_custom_store_logic\",\"title\":\"Custom store logic\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"svelte_store_contract_subscribe_method\",\"title\":\"Store contract (subscribe method)\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"svelte_context_api_vs_stores\",\"title\":\"Context API vs stores\",\"order\":8,\"has_content\":true}]},{\"topic_id\":\"svelte_p2_t3\",\"title\":\"Transitions and Animations\",\"order\":3,\"pattern_count\":9,\"patterns\":[{\"pattern_id\":\"svelte_why_transitions_enhance_user_experience\",\"title\":\"Why transitions enhance user experience\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"svelte_transition_directive_transitionfade\",\"title\":\"Transition directive (transition:fade)\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"svelte_in_and_out_transitions\",\"title\":\"In and out transitions\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"svelte_transition_parameters_duration_delay\",\"title\":\"Transition parameters (duration, delay)\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"svelte_custom_transitions\",\"title\":\"Custom transitions\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"svelte_animate_directive\",\"title\":\"Animate directive\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"svelte_flip_animations\",\"title\":\"Flip animations\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"svelte_crossfade_for_list_items\",\"title\":\"Crossfade for list items\",\"order\":8,\"has_content\":true},{\"pattern_id\":\"svelte_deferred_transitions\",\"title\":\"Deferred transitions\",\"order\":9,\"has_content\":true}]},{\"topic_id\":\"svelte_p2_t4\",\"title\":\"Actions\",\"order\":4,\"pattern_count\":6,\"patterns\":[{\"pattern_id\":\"svelte_why_actions_add_reusable_element_behavior\",\"title\":\"Why actions add reusable element behavior\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"svelte_use_directive_syntax\",\"title\":\"Use directive syntax\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"svelte_action_parameters\",\"title\":\"Action parameters\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"svelte_action_update_and_destroy\",\"title\":\"Action update and destroy\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"svelte_common_action_patterns_clickoutside_tooltip\",\"title\":\"Common action patterns (click-outside, tooltip)\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"svelte_action_with_event_dispatching\",\"title\":\"Action with event dispatching\",\"order\":6,\"has_content\":true}]},{\"topic_id\":\"svelte_p2_t5\",\"title\":\"Special Elements\",\"order\":5,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"svelte_why_special_elements_handle_edge_cases\",\"title\":\"Why special elements handle edge cases\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"svelte_sveltecomponent_for_dynamic_components\",\"title\":\"svelte:component for dynamic components\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"svelte_svelteelement_for_dynamic_tags\",\"title\":\"svelte:element for dynamic tags\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"svelte_sveltewindow_for_window_events\",\"title\":\"svelte:window for window events\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"svelte_sveltebody_for_body_events\",\"title\":\"svelte:body for body events\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"svelte_sveltehead_for_document_head\",\"title\":\"svelte:head for document head\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"svelte_svelteself_for_recursive_components\",\"title\":\"svelte:self for recursive components\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"svelte_sveltefragment_for_grouping\",\"title\":\"svelte:fragment for grouping\",\"order\":8,\"has_content\":true}]},{\"topic_id\":\"svelte_p2_t6\",\"title\":\"Context API\",\"order\":6,\"pattern_count\":6,\"patterns\":[{\"pattern_id\":\"svelte_why_context_shares_data_without_prop_drilling\",\"title\":\"Why context shares data without prop drilling\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"svelte_setcontext\",\"title\":\"setContext\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"svelte_getcontext\",\"title\":\"getContext\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"svelte_context_with_stores\",\"title\":\"Context with stores\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"svelte_context_key_patterns\",\"title\":\"Context key patterns\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"svelte_context_vs_stores_decision\",\"title\":\"Context vs stores decision\",\"order\":6,\"has_content\":true}]},{\"topic_id\":\"svelte_p2_t7\",\"title\":\"Advanced Styling\",\"order\":7,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"svelte_why_advanced_styling_creates_polished_uis\",\"title\":\"Why advanced styling creates polished UIs\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"svelte_css_custom_properties_variables\",\"title\":\"CSS custom properties (variables)\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"svelte_passing_styles_to_components_styleprops\",\"title\":\"Passing styles to components (--style-props)\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"svelte_conditional_classes_classname\",\"title\":\"Conditional classes (class:name)\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"svelte_dynamic_inline_styles\",\"title\":\"Dynamic inline styles\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"svelte_cssinjs_patterns_with_svelte\",\"title\":\"CSS-in-JS patterns with Svelte\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"svelte_preprocessor_support_scss_postcss\",\"title\":\"Preprocessor support (SCSS, PostCSS)\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"svelte_global_vs_scoped_style_strategies\",\"title\":\"Global vs scoped style strategies\",\"order\":8,\"has_content\":true}]}]},\"modeCode\":\"CMC\",\"productId\":\"codefly\"}]]\n"])</script><script>self.__next_f.push([1,"18:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"svelte:head for document head Practice Problems - Coding Exercises | Leyaa.ai\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Solve svelte:head for document head coding challenges from easy to hard. Practice problems with hints, solutions, and step-by-step explanations. Free practice.\"}],[\"$\",\"meta\",\"4\",{\"name\":\"author\",\"content\":\"Leyaa.ai\"}],[\"$\",\"link\",\"5\",{\"rel\":\"manifest\",\"href\":\"/manifest.json\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"6\",{\"name\":\"keywords\",\"content\":\"learning intelligence,AI learning,personalized learning,adaptive learning,study guide,exam preparation,learning platform,education technology,edtech,smart learning\"}],[\"$\",\"meta\",\"7\",{\"name\":\"creator\",\"content\":\"Leyaa.ai\"}],[\"$\",\"meta\",\"8\",{\"name\":\"publisher\",\"content\":\"Leyaa.ai\"}],[\"$\",\"meta\",\"9\",{\"name\":\"robots\",\"content\":\"index, follow\"}],[\"$\",\"meta\",\"10\",{\"name\":\"googlebot\",\"content\":\"index, follow, max-image-preview:large, max-snippet:-1\"}],[\"$\",\"meta\",\"11\",{\"name\":\"mobile-web-app-capable\",\"content\":\"yes\"}],[\"$\",\"meta\",\"12\",{\"name\":\"content-language\",\"content\":\"en\"}],[\"$\",\"link\",\"13\",{\"rel\":\"canonical\",\"href\":\"https://leyaa.ai/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/challenge\"}],[\"$\",\"link\",\"14\",{\"rel\":\"alternate\",\"hrefLang\":\"en\",\"href\":\"https://leyaa.ai/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/challenge\"}],[\"$\",\"link\",\"15\",{\"rel\":\"alternate\",\"hrefLang\":\"x-default\",\"href\":\"https://leyaa.ai/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/challenge\"}],[\"$\",\"meta\",\"16\",{\"name\":\"apple-mobile-web-app-capable\",\"content\":\"yes\"}],[\"$\",\"meta\",\"17\",{\"name\":\"apple-mobile-web-app-title\",\"content\":\"Leyaa\"}],[\"$\",\"meta\",\"18\",{\"name\":\"apple-mobile-web-app-status-bar-style\",\"content\":\"default\"}],[\"$\",\"meta\",\"19\",{\"property\":\"og:title\",\"content\":\"svelte:head for document head Practice Problems - Coding Exercises | Leyaa.ai\"}],[\"$\",\"meta\",\"20\",{\"property\":\"og:description\",\"content\":\"Solve svelte:head for document head coding challenges from easy to hard. Practice problems with hints, solutions, and step-by-step explanations. Free practice.\"}],[\"$\",\"meta\",\"21\",{\"property\":\"og:url\",\"content\":\"https://leyaa.ai/codefly/learn/svelte/part-2/svelte-sveltehead-for-document-head/challenge\"}],[\"$\",\"meta\",\"22\",{\"property\":\"og:locale\",\"content\":\"en_US\"}],[\"$\",\"meta\",\"23\",{\"property\":\"og:image\",\"content\":\"https://leyaa.ai/Assets/metaImages/leyaa-preview-image.png\"}],[\"$\",\"meta\",\"24\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"25\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"26\",{\"property\":\"og:image:alt\",\"content\":\"svelte:head for document head Practice Problems - Coding Exercises\"}],[\"$\",\"meta\",\"27\",{\"property\":\"og:type\",\"content\":\"article\"}],[\"$\",\"meta\",\"28\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"29\",{\"name\":\"twitter:site\",\"content\":\"@leyaaai\"}],[\"$\",\"meta\",\"30\",{\"name\":\"twitter:creator\",\"content\":\"@leyaaai\"}],[\"$\",\"meta\",\"31\",{\"name\":\"twitter:title\",\"content\":\"svelte:head for document head Practice Problems - Coding Exercises | Leyaa.ai\"}],[\"$\",\"meta\",\"32\",{\"name\":\"twitter:description\",\"content\":\"Solve svelte:head for document head coding challenges from easy to hard. Practice problems with hints, solutions, and step-by-step explanations. Free practice.\"}],[\"$\",\"meta\",\"33\",{\"name\":\"twitter:image\",\"content\":\"https://leyaa.ai/Assets/metaImages/leyaa-preview-image.png\"}],[\"$\",\"link\",\"34\",{\"rel\":\"icon\",\"href\":\"/leyaa-logo.png\"}],[\"$\",\"link\",\"35\",{\"rel\":\"apple-touch-icon\",\"href\":\"https://leyaa.ai/Assets/Favicons/apple-touch-icon.png\"}],[\"$\",\"meta\",\"36\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"a:null\n"])</script></body></html>