-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<:Document title='blah'/> #1013
Comments
Being able to set the document title in my top-level component would be awesome! That |
What about meta headers, etc. are they planned to be included as part of <:Document> implementation? |
@vanesyan I don't have any specific plans about that currently. What kind of things do you generally need? (that differ from page-to-page — site-wide stuff is best handled outside Svelte, I think). |
Don't know, but I found Next.js |
IMHO, it's good to keep everything related at the same generic component, that do all that stuff out-of-the-box, rather than compose em' with different components. |
I wonder if there's a case for a On the server, it could be separated out like so: const { html, css, title, head } = Component.render(...); Strictly speaking, const title = document.createElement('title');
title.textContent = 'blah';
head.appendChild(title); What does everyone reckon? |
We can analyse the children of |
That's very true. I'm just lazy 😆 |
update SSR render method, and introduce <:Head>
|
Am building a Hacker News implementation using Sapper to see what it, and Svelte, are missing. One thing that it's clear we need is a declarative way to set the document title.
I propose the addition of a
<:Document>
meta-component with atitle
property. Ideally it would simply compile to something like this:On the server side, we would need to change the behaviour of the
render
function. Right now it returns an HTML string. I think it should return an object instead:As long as the returned object has a
toString
method, we can do this in a non-breaking way. (Thecss
property would be a{ code, map }
object.)The text was updated successfully, but these errors were encountered: