mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add support for responsive preloads
This commit is contained in:
parent
6d1f6c765d
commit
5b3e0721fd
1 changed files with 10 additions and 7 deletions
|
|
@ -5,7 +5,10 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
import { catchRedirectResponse } from '~/helpers/astro/request.js'
|
import { catchRedirectResponse } from '~/helpers/astro/request.js'
|
||||||
import { ListingDetails } from '~/helpers/listing-page.js'
|
import {
|
||||||
|
getVideoImages,
|
||||||
|
ListingDetails
|
||||||
|
} from '~/helpers/listing-page.js'
|
||||||
import { getPathPartsFromAstroRequest } from '~/helpers/url.js'
|
import { getPathPartsFromAstroRequest } from '~/helpers/url.js'
|
||||||
|
|
||||||
import Layout from '~/src/layouts/default.astro'
|
import Layout from '~/src/layouts/default.astro'
|
||||||
|
|
@ -59,13 +62,13 @@ const headOptions = listingDetails.headOptions
|
||||||
|
|
||||||
if ( isBenchmarkPage ) {
|
if ( isBenchmarkPage ) {
|
||||||
|
|
||||||
|
const { preloads } = getVideoImages( listingDetails.initialVideo )
|
||||||
|
|
||||||
// Preload video thumbnail
|
// Preload video thumbnail
|
||||||
// <link rel="preload" as="image" href="img.png" />
|
headOptions.link = [
|
||||||
headOptions.link.push({
|
...headOptions.link,
|
||||||
'rel': 'preload',
|
...preloads
|
||||||
'as': 'image',
|
]
|
||||||
'href': `https://i.ytimg.com/vi_webp/${ listingDetails.initialVideo.id }/sddefault.webp`
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue