Add a way to hoist meta and link tags to <head> #56
RafidMuhymin
started this conversation in
Proposal
Replies: 2 comments
-
<html lang="en">
<head>
{noindex ? <meta name="robots" content="noindex"> : null}
{warn ? <meta name="rating" content="adult"> : null}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="theme-color" content="#0aa06e"/>
<meta name="author" content={config.author}>
<meta name="description" content={Astro.props.is ? `${config.author} is ${Astro.props.is}.` : `Some ramblings about ${Astro.props.title}!`}>
<title>{title}</title>
</head>
<body>
<div>
<article>
<slot name="title">
<h2>{title}</h2>
</slot>
<slot/>
</article>
<Footer/>
</div> |
Beta Was this translation helpful? Give feedback.
0 replies
-
There's an accepted RFC to finalize https://github.com/withastro/rfcs/blob/main/active-rfcs/0007-finalize-head-body.md |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There should be a way to hoist
<meta>
and<link>
(or any other tag that should be inside<head>
) to the<head>
of the page. IIRC it was done by default beforev0.21
. And it's a necessary feature also I think.An example use case:
Most of the images on a webpage should be lazily loaded. But some images like banners, hero images, or logos (it should be inline though) should be eagerly loaded. To do this, one should not only tell the browser to eagerly load the image using
loading="eager"
but he should also preload the image. For this, users can pass a format using thepreload
prop to the<Image>
component to eagerly preload the image.But when I was implementing this feature I found that unlike
v0.20
,<link>
,<meta>
or other tags that should be in the<head>
of the page aren't hoisted.So, not only the
<Image>
component is affected but any third-party package or a user who wants to implement a similar thing/feature can't do this.Beta Was this translation helpful? Give feedback.
All reactions