Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion website/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ sidebar: false

<script setup>
import { onMounted } from 'vue'
import { Image } from '@unpic/vue'

import { data as posts } from './data/posts.data.ts'

Expand Down Expand Up @@ -112,7 +113,14 @@ onMounted(async () => {
<div class="container">
<main>
<div class="header">
<img src="/img/blog/electric-elephant.jpg" />
<Image
src="/img/blog/electric-elephant.jpg"
:width="720"
:height="720"
layout="constrained"
background="auto"
fallback="netlify"
/>
<h1>
ElectricSQL Blog
</h1>
Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"yaml": "^2.5.0"
},
"dependencies": {
"@unpic/vue": "^1.0.0",
"posthog-js": "^1.236.4"
}
}
37 changes: 8 additions & 29 deletions website/src/components/BlogPostHeader.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup>
import { useData } from 'vitepress'
import { computed } from 'vue'
import { Image } from '@unpic/vue'

import { data as authors } from '../../data/authors.data.ts'
import { getNetlifyImageUrl } from '../utils/netlify-images.ts'

const { page, frontmatter } = useData()

Expand All @@ -22,31 +22,6 @@ const formattedDate = computed(() => {
timeZone: 'UTC',
})
})

const optimizedImageSrcset = computed(() => {
if (!frontmatter.value.image) return { src: '', srcset: '' }

const img1x = getNetlifyImageUrl(frontmatter.value.image, {
width: 1530,
height: 874,
fit: 'cover',
format: 'jpg',
quality: 80,
})

const img2x = getNetlifyImageUrl(frontmatter.value.image, {
width: 1530 * 2,
height: 874 * 2,
fit: 'cover',
format: 'jpg',
quality: 80,
})

return {
src: img1x,
srcset: `${img1x} 1x, ${img2x} 2x`,
}
})
</script>

<style scoped>
Expand Down Expand Up @@ -101,9 +76,13 @@ h1 {
<template>
<div class="post-header">
<p class="post-image">
<img
:src="optimizedImageSrcset.src"
:srcset="optimizedImageSrcset.srcset"
<Image
:src="frontmatter.image"
:width="1530"
:height="874"
layout="constrained"
background="auto"
fallback="netlify"
/>
</p>
<h1>
Expand Down
Loading