Skip to content

Commit a8e9cfc

Browse files
fix: Lighthouse stuff (#685)
* refactor: optimize some images, fix logo layout shift * chore: enable view transitions for Chrome & Safari users * fix: static assets cache path * fix: big hero image --------- Co-authored-by: Strokkur24 <[email protected]>
1 parent 651ccb9 commit a8e9cfc

File tree

7 files changed

+47
-35
lines changed

7 files changed

+47
-35
lines changed

_headers

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/assets/(.*)
2-
cache-control: public, immutable, max-age=31536000
1+
/_astro/*
2+
Cache-Control: public, max-age=31536000, immutable

astro.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ export default defineConfig({
539539
image: {
540540
responsiveStyles: true,
541541
layout: "constrained",
542+
domains: ["assets.papermc.io"],
542543
},
543544
markdown: {
544545
remarkPlugins: [

src/components/overrides/Head.astro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ const base = stripTrailingSlash(import.meta.env.BASE_URL);
5959
<meta property="og:image" content="https://assets.papermc.io/brand/papermc_logo.512.png" />
6060
<meta name="twitter:image" content="https://assets.papermc.io/brand/papermc_logo.512.png" />
6161

62-
<link rel="preload" as="image" type="image/svg+xml" href="https://assets.papermc.io/brand/papermc_combination_mark_light.min.svg" />
63-
<link rel="preload" as="image" type="image/svg+xml" href="https://assets.papermc.io/brand/papermc_combination_mark_dark.min.svg" />
6462
<link rel="preload" as="font" type="font/woff2" href={poppins400Woff2} crossorigin="anonymous" />
6563
<link rel="preload" as="font" type="font/woff2" href={poppins500Woff2} crossorigin="anonymous" />
6664
<link rel="preload" as="font" type="font/woff2" href={jetbrainsMono400Woff2} crossorigin="anonymous" />

src/components/overrides/SiteTitle.astro

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
---
2+
import { Image } from "astro:assets";
3+
24
const { siteTitle, siteTitleHref } = Astro.locals.starlightRoute;
35
---
46

57
<a href={siteTitleHref} class="site-title sl-flex">
6-
<img
8+
<Image
9+
inferSize
10+
priority
711
class="light:sl-hidden print:hidden"
812
alt="PaperMC Logo (Light)"
913
src="https://assets.papermc.io/brand/papermc_combination_mark_light.min.svg"
1014
/>
11-
<img
15+
<Image
16+
inferSize
17+
priority
1218
class="dark:sl-hidden print:block"
1319
alt="PaperMC Logo (Dark)"
1420
src="https://assets.papermc.io/brand/papermc_combination_mark_dark.min.svg"

src/content/docs/adventure/minimessage/format.mdx

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ slug: adventure/minimessage/format
44
description: The MiniMessage format documentation.
55
---
66

7+
import { Image } from "astro:assets";
78
import Shadow1 from "./assets/shadow_1.png";
89
import Shadow2 from "./assets/shadow_2.png";
910
import Shadow3 from "./assets/shadow_3.png";
@@ -96,8 +97,8 @@ Examples
9697

9798
<br/>
9899

99-
<img style="all: initial" alt="The result of parsing `<yellow>Hello <blue>World</blue>!`, shown in-game in the Minecraft client's chat window" src={Color1.src} />
100-
<img style="all: initial" alt="The result of parsing `<red>This is a <green>test!`, shown in-game in the Minecraft client's chat window" src={Color2.src} />
100+
<Image class="img-inline" alt="The result of parsing `<yellow>Hello <blue>World</blue>!`, shown in-game in the Minecraft client's chat window" src={Color1} />
101+
<Image class="img-inline" alt="The result of parsing `<red>This is a <green>test!`, shown in-game in the Minecraft client's chat window" src={Color2} />
101102

102103
### Color (verbose)
103104

@@ -122,8 +123,8 @@ Examples
122123

123124
<br/>
124125

125-
<img style="all: initial" alt="The result of parsing `<color:yellow>Hello <color:blue>World</color:blue>!`, shown in-game in the Minecraft client's chat window" src={ColorVerbose1.src} />
126-
<img style="all: initial" alt="The result of parsing `<color:#FF5555>This is a <color:#55FF55>test!`, shown in-game in the Minecraft client's chat window" src={ColorVerbose2.src} />
126+
<Image class="img-inline" alt="The result of parsing `<color:yellow>Hello <color:blue>World</color:blue>!`, shown in-game in the Minecraft client's chat window" src={ColorVerbose1} />
127+
<Image class="img-inline" alt="The result of parsing `<color:#FF5555>This is a <color:#55FF55>test!`, shown in-game in the Minecraft client's chat window" src={ColorVerbose2} />
127128

128129
### Shadow Color
129130

@@ -146,9 +147,9 @@ Examples
146147

147148
<br/>
148149

149-
<img src={Shadow1.src} style="all: initial" alt="The result of parsing `<shadow:yellow>Hello <shadow:aqua:0.5>World</shadow>!` shown in-game in the Minecraft client's chat window"/>
150-
<img src={Shadow2.src} style="all: initial" alt="The result of parsing `<shadow:#FF5555>This is a <shadow:#55FF55>test!` shown in-game in the Minecraft client's chat window"/>
151-
<img src={Shadow3.src} style="all: initial" alt="The result of parsing `<shadow:#000000FF><b>Thicc` shown in-game in the Minecraft client's chat window"/>
150+
<Image class="img-inline" src={Shadow1} alt="The result of parsing `<shadow:yellow>Hello <shadow:aqua:0.5>World</shadow>!` shown in-game in the Minecraft client's chat window"/>
151+
<Image class="img-inline" src={Shadow2} alt="The result of parsing `<shadow:#FF5555>This is a <shadow:#55FF55>test!` shown in-game in the Minecraft client's chat window"/>
152+
<Image class="img-inline" src={Shadow3} alt="The result of parsing `<shadow:#000000FF><b>Thicc` shown in-game in the Minecraft client's chat window"/>
152153

153154
### Decoration
154155

@@ -174,7 +175,7 @@ Examples
174175
```
175176

176177
<br/>
177-
<img style="all: initial" alt="The result of parsing `<underlined>This is <bold>important</bold>!`, shown in-game in the Minecraft client's chat window" src={Decoration1.src} />
178+
<Image class="img-inline" alt="The result of parsing `<underlined>This is <bold>important</bold>!`, shown in-game in the Minecraft client's chat window" src={Decoration1} />
178179

179180
### Reset
180181

@@ -194,7 +195,7 @@ Examples
194195
```
195196

196197
<br/>
197-
<img style="all: initial" alt="The result of parsing `<yellow><bold>Hello <reset>world!`, shown in-game in the Minecraft client's chat window" src={Reset1.src} />
198+
<Image class="img-inline" alt="The result of parsing `<yellow><bold>Hello <reset>world!`, shown in-game in the Minecraft client's chat window" src={Reset1} />
198199

199200
### Click
200201

@@ -214,7 +215,7 @@ Click <click:copy_to_clipboard:Haha you suck> this </click>to copy your score!
214215
```
215216

216217
<br/>
217-
<img style="all: initial" alt="The result of parsing `<click:run_command:/seed>Click</click> to show the world seed!`, shown in-game in the Minecraft client's chat window" src={Click1.src} />
218+
<Image class="img-inline" alt="The result of parsing `<click:run_command:/seed>Click</click> to show the world seed!`, shown in-game in the Minecraft client's chat window" src={Click1} />
218219

219220
:::caution
220221

@@ -246,7 +247,7 @@ Examples
246247
```
247248

248249
<br/>
249-
<img style="all: initial" alt="The result of parsing `<hover:show_text:'<red>test'>TEST`, shown in-game in the Minecraft client's chat window" src={Hover1.src} />
250+
<Image class="img-inline" alt="The result of parsing `<hover:show_text:'<red>test'>TEST`, shown in-game in the Minecraft client's chat window" src={Hover1} />
250251

251252
### Keybind
252253

@@ -264,7 +265,7 @@ Press <red><key:key.jump> to jump!
264265
```
265266

266267
<br/>
267-
<img style="all: initial" alt="The result of parsing `Press <red><key:key.jump> to jump!`, shown in-game in the Minecraft client's chat window" src={Key1.src} />
268+
<Image class="img-inline" alt="The result of parsing `Press <red><key:key.jump> to jump!`, shown in-game in the Minecraft client's chat window" src={Key1} />
268269

269270
### Translatable
270271

@@ -287,8 +288,8 @@ You should get a <lang:block.minecraft.diamond_block>!
287288
```
288289

289290
<br/>
290-
<img style="all: initial" alt="The result of parsing `You should get a <lang:block.minecraft.diamond_block>!`, shown in-game in the Minecraft client's chat window in English" src={Translatable1.src} />
291-
<img style="all: initial" alt="The result of parsing `<lang:commands.drop.success.single:'<red>1':'<blue>Stone'>!`, shown in-game in the Minecraft client's chat window in English" src={Translatable2.src} />
291+
<Image class="img-inline" alt="The result of parsing `You should get a <lang:block.minecraft.diamond_block>!`, shown in-game in the Minecraft client's chat window in English" src={Translatable1} />
292+
<Image class="img-inline" alt="The result of parsing `<lang:commands.drop.success.single:'<red>1':'<blue>Stone'>!`, shown in-game in the Minecraft client's chat window in English" src={Translatable2} />
292293

293294
### Fallback
294295

@@ -332,7 +333,7 @@ Shift-click <insert:test>this</insert> to insert!
332333
```
333334

334335
<br/>
335-
<img style="all: initial" alt="The result of parsing `Shift-click <insert:test>this</insert> to insert!`, shown in-game in the Minecraft client's chat window" src={Insertion1.src} />
336+
<Image class="img-inline" alt="The result of parsing `Shift-click <insert:test>this</insert> to insert!`, shown in-game in the Minecraft client's chat window" src={Insertion1} />
336337

337338
### Rainbow
338339

@@ -354,7 +355,7 @@ Examples
354355
```
355356

356357
<br/>
357-
<img style="all: initial" alt="The result of parsing all four examples in series, shown in-game in the Minecraft client's chat window" src={Rainbow1.src} />
358+
<Image class="img-inline" alt="The result of parsing all four examples in series, shown in-game in the Minecraft client's chat window" src={Rainbow1} />
358359

359360
### Gradient
360361

@@ -375,7 +376,7 @@ Examples
375376
```
376377

377378
<br/>
378-
<img style="all: initial" alt="The result of parsing the examples for the gradient tag, shown in-game in the Minecraft client's chat window" src={Gradient1.src} />
379+
<Image class="img-inline" alt="The result of parsing the examples for the gradient tag, shown in-game in the Minecraft client's chat window" src={Gradient1} />
379380

380381
### Transition
381382

@@ -393,7 +394,7 @@ Examples
393394
```
394395

395396
<br/>
396-
<img style="all: initial" alt="The result of parsing `<transition:white:black:red:[phase]>Hello World [phase]</transition>`, shown in-game in the Minecraft client's chat window" src={Transition1.src} />
397+
<Image class="img-inline" alt="The result of parsing `<transition:white:black:red:[phase]>Hello World [phase]</transition>`, shown in-game in the Minecraft client's chat window" src={Transition1} />
397398

398399
### Font
399400

@@ -412,7 +413,7 @@ Nothing <font:uniform>Uniform <font:alt>Alt </font> Uniform
412413
```
413414

414415
<br/>
415-
<img style="all: initial" alt="The result of parsing `Nothing <font:uniform>Uniform <font:alt>Alt </font> Uniform`, shown in-game in the Minecraft client's chat window" src={Font1.src} />
416+
<Image class="img-inline" alt="The result of parsing `Nothing <font:uniform>Uniform <font:alt>Alt </font> Uniform`, shown in-game in the Minecraft client's chat window" src={Font1} />
416417

417418
### Newline
418419

@@ -434,7 +435,7 @@ Let me insert a <newline>line break here.
434435
```
435436

436437
<br/>
437-
<img style="all: initial" alt="The result of parsing `<hover:show_text:'<red>Hover with a<newline><green>line break'>Text with<newline>line break</hover>`, shown in-game in the Minecraft client's chat window" src={Newline1.src} />
438+
<Image class="img-inline" alt="The result of parsing `<hover:show_text:'<red>Hover with a<newline><green>line break'>Text with<newline>line break</hover>`, shown in-game in the Minecraft client's chat window" src={Newline1} />
438439

439440
### Selector
440441

@@ -456,7 +457,7 @@ Hello <selector:@e[limit=5]>, I'm <selector:@s>!
456457
```
457458

458459
<br/>
459-
<img style="all: initial" alt="The result of parsing `Hello <selector:@e[limit=5]>, I'm <selector:@s>!`, show in-game in the Minecraft client's chat window" src={Selector1.src} />
460+
<Image class="img-inline" alt="The result of parsing `Hello <selector:@e[limit=5]>, I'm <selector:@s>!`, show in-game in the Minecraft client's chat window" src={Selector1} />
460461

461462
### Score
462463

src/content/docs/index.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ hero:
88
title: PaperMC Docs
99
tagline: Documentation for all projects under the PaperMC umbrella, including Paper, Velocity and Folia.
1010
image:
11-
html: '<img src="https://assets.papermc.io/brand/papermc_logo.min.svg" alt="PaperMC Logo">'
11+
file: "https://assets.papermc.io/brand/papermc_logo.min.svg"
12+
alt: PaperMC Logo
1213
---
1314

1415
import { CardGrid } from "@astrojs/starlight/components";

src/styles/custom.css

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@
2424
.sl-markdown-content img:not(:where(.not-content *)):not([alt="Diagram"]) {
2525
width: 100%;
2626
}
27-
.sl-markdown-content .img-inline img {
27+
/* except when we want them inline */
28+
.sl-markdown-content :is(img.img-inline, .img-inline img) {
2829
margin: 0;
2930
width: auto;
3031
}
31-
.sl-markdown-content .img-inline-center img {
32+
.sl-markdown-content img.img-inline {
33+
display: inline-block;
34+
}
35+
.sl-markdown-content :is(img.img-inline-center, .img-inline-center img) {
3236
width: auto;
3337
}
3438

@@ -37,12 +41,8 @@
3741
font-family: var(--__sl-font-mono);
3842
}
3943

40-
/* Safari fixes for logo sizing */
41-
.hero-html > img {
42-
object-fit: contain;
44+
.hero > img {
4345
width: min(70%, 20rem);
44-
height: auto;
45-
margin-inline: auto;
4646
}
4747

4848
/* make index page hero smaller vertically */
@@ -59,6 +59,11 @@
5959
}
6060
}
6161

62+
/* magic */
63+
@view-transition {
64+
navigation: auto;
65+
}
66+
6267
/* Dark mode colors. */
6368
:root {
6469
--sl-color-accent-low: #1e3a8a;

0 commit comments

Comments
 (0)