mirror of https://github.com/sveltejs/svelte
SSR should only render one <title> (#4250)
parent
7c3e34c00b
commit
ef56a70acb
@ -1,10 +1,16 @@
|
||||
import Renderer, { RenderOptions } from '../Renderer';
|
||||
import Title from '../../nodes/Title';
|
||||
import { x } from 'code-red';
|
||||
|
||||
export default function(node: Title, renderer: Renderer, options: RenderOptions) {
|
||||
renderer.push();
|
||||
|
||||
renderer.add_string(`<title>`);
|
||||
|
||||
renderer.render(node.children, options);
|
||||
|
||||
renderer.add_string(`</title>`);
|
||||
const result = renderer.pop();
|
||||
|
||||
renderer.add_expression(x`($$result.title = ${result}, "")`);
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
<svelte:head>
|
||||
<title>A</title>
|
||||
</svelte:head>
|
@ -0,0 +1,3 @@
|
||||
<svelte:head>
|
||||
<title>B</title>
|
||||
</svelte:head>
|
@ -0,0 +1 @@
|
||||
<title>B</title>
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"adjective": "custom"
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import A from './A.svelte';
|
||||
import B from './B.svelte';
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Main</title>
|
||||
</svelte:head>
|
||||
<A />
|
||||
<B />
|
Loading…
Reference in new issue