-
-
Notifications
You must be signed in to change notification settings - Fork 371
feat: new og images #2292
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
Open
harlan-zw
wants to merge
57
commits into
npmx-dev:main
Choose a base branch
from
harlan-zw:feat/og-image-v7
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: new og images #2292
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
a04f84f
feat: nuxt og image v6
harlan-zw 0198696
chore: sync
harlan-zw b76f0e2
Merge branch 'main' of github.com:harlan-zw/fork-npmx.dev into feat/o…
harlan-zw fb61483
chore: sync
harlan-zw b4b7ffc
chore: sync
harlan-zw 440bdb1
chore: sync
harlan-zw 6e89cb9
chore: sync
harlan-zw b366eaa
chore: sync
harlan-zw 17e7ef7
chore: sync
harlan-zw 6c3add5
Merge remote-tracking branch 'origin/main' into feat/og-image-v6
danielroe b69a6df
fix: small fixes
danielroe 25f3f96
Merge remote-tracking branch 'origin/main' into feat/og-image-v6
danielroe 347cbcc
chore: reorder
danielroe 8d8a3ee
ci: bump memory
danielroe 8e1c597
Merge remote-tracking branch 'origin/main' into feat/og-image-v6
danielroe 2cdcc35
chore: sync
harlan-zw 114f2e3
Merge remote-tracking branch 'origin/feat/og-image-v6' into feat/og-i…
harlan-zw 499668f
chore: opacity
harlan-zw 4d5afa5
fix: use utc dates, handle division by zero, + add tanstack fixture
danielroe b196d5a
Merge remote-tracking branch 'origin/main' into feat/og-image-v6
danielroe a1259f7
chore: lint
danielroe 49a9014
fix: rename og-image snapshot for home path
danielroe 6e62678
fix: remove UnoCSS pipeline exclude that broke a11y tests
danielroe 9d7060c
chore: opps
danielroe 83fa423
fix: preserve UnoCSS default pipeline excludes alongside takumi exclude
danielroe 449232c
ci: switch browser tests to x64 runner for Takumi WASM compat
danielroe 9800fc1
revert: restore browser test ARM runner
danielroe b1cae8f
chore: bump og image
harlan-zw 81c6227
chore: bump takumi
harlan-zw f65e30f
Merge branch 'main' of github.com:harlan-zw/fork-npmx.dev into feat/o…
harlan-zw 2382633
chore: sync lock
harlan-zw 42896a1
Merge branch 'main' of github.com:harlan-zw/fork-npmx.dev into feat/o…
harlan-zw 1f12d07
chore: blog post
harlan-zw ff5c315
Merge branch 'main' of github.com:harlan-zw/fork-npmx.dev into feat/o…
harlan-zw f794422
chore: sync
harlan-zw 44eb192
chore: sync
harlan-zw f2de5ad
Merge branch 'main' of github.com:harlan-zw/fork-npmx.dev into feat/o…
harlan-zw 4d97d7f
Merge branch 'main' of github.com:harlan-zw/fork-npmx.dev into feat/o…
harlan-zw 6a86fa3
feat: og images
harlan-zw 533a466
chore: takumi v1 beta
harlan-zw 00b80ec
fix: og image alts
harlan-zw a2e4207
Merge branch 'main' into feat/og-image-v6
harlan-zw 3a762ab
chore: misc issues
harlan-zw 52ed139
Merge upstream/main into feat/og-image-v7
harlan-zw c02a6a8
fix: convert remaining pages to defineOgImage API and sync with upstream
harlan-zw c3687a1
fix: remove unused i18n key and disable long-title validation
harlan-zw 0908bb7
chore: bump nuxt-og-image to 6.2.6, takumi to 1.0.0-beta.20
harlan-zw 295722d
chore: bump deps, fix test build prerender
harlan-zw a09e45c
chore: clean up PR scope, revert unrelated changes
harlan-zw 95b7ff2
fix: blog OG avatar stacking, remove htmlValidator regexes, add ogIma…
harlan-zw 327c7b8
fix: patch @nuxt/test-utils structuredClone crash with nuxt-og-image v6
harlan-zw ebe0a5b
fix: remove @nuxt/test-utils patch, fix upstream in nuxt-site-config
harlan-zw 4d97433
fix: patch @nuxt/test-utils structuredClone for cross-context objects
harlan-zw fe4d826
Merge branch 'main' into feat/og-image-v7
danielroe 8e5041e
[autofix.ci] apply automated fixes
autofix-ci[bot] 0879add
Merge remote-tracking branch 'origin/main' into feat/og-image-v7
harlan-zw 515f99b
chore: reduce PR scope, revert unrelated i18n and branding changes
harlan-zw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <script setup lang="ts"> | ||
| const props = withDefaults( | ||
| defineProps<{ | ||
| height?: number | ||
| }>(), | ||
| { | ||
| height: 60, | ||
| }, | ||
| ) | ||
|
|
||
| const width = computed(() => Math.round(props.height * (602 / 170))) | ||
| </script> | ||
|
|
||
| <template> | ||
| <img | ||
| src="/logo.svg" | ||
| alt="npmx" | ||
| :width="width" | ||
| :height="height" | ||
| :style="{ width: `${width}px`, height: `${height}px` }" | ||
| /> | ||
| </template> |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| <script setup lang="ts"> | ||
| import type { ResolvedAuthor } from '#shared/schemas/blog' | ||
|
|
||
| const { | ||
| title, | ||
| authors = [], | ||
| date = '', | ||
| } = defineProps<{ | ||
| title: string | ||
| authors?: ResolvedAuthor[] | ||
| date?: string | ||
| }>() | ||
|
|
||
| const formattedDate = computed(() => { | ||
| if (!date) return '' | ||
| try { | ||
| return new Date(date).toLocaleDateString('en-US', { | ||
| year: 'numeric', | ||
| month: 'short', | ||
| day: 'numeric', | ||
| }) | ||
| } catch { | ||
| return date | ||
| } | ||
| }) | ||
|
|
||
| const MAX_VISIBLE_AUTHORS = 2 | ||
|
|
||
| const getInitials = (name: string) => | ||
| name | ||
| .split(' ') | ||
| .map(n => n[0]) | ||
| .join('') | ||
| .toUpperCase() | ||
| .slice(0, 2) | ||
|
|
||
| const visibleAuthors = computed(() => { | ||
| if (authors.length <= 3) return authors | ||
| return authors.slice(0, MAX_VISIBLE_AUTHORS) | ||
| }) | ||
|
|
||
| const extraCount = computed(() => { | ||
| if (authors.length <= 3) return 0 | ||
| return authors.length - MAX_VISIBLE_AUTHORS | ||
| }) | ||
|
|
||
| const formattedAuthorNames = computed(() => { | ||
| const allNames = authors.map(a => a.name) | ||
| if (allNames.length === 0) return '' | ||
| if (allNames.length === 1) return allNames[0] | ||
| if (allNames.length === 2) return `${allNames[0]} and ${allNames[1]}` | ||
| if (allNames.length === 3) return `${allNames[0]}, ${allNames[1]}, and ${allNames[2]}` | ||
| const shown = allNames.slice(0, MAX_VISIBLE_AUTHORS) | ||
| const remaining = allNames.length - MAX_VISIBLE_AUTHORS | ||
| return `${shown.join(', ')} and ${remaining} others` | ||
| }) | ||
| </script> | ||
|
|
||
| <template> | ||
| <OgLayout> | ||
| <div class="px-15 py-12 flex flex-col justify-center gap-5 h-full"> | ||
| <OgBrand :height="48" /> | ||
|
|
||
| <!-- Date + Title --> | ||
| <div class="flex flex-col gap-2"> | ||
| <span v-if="formattedDate" class="text-3xl text-fg-muted"> | ||
| {{ formattedDate }} | ||
| </span> | ||
|
|
||
| <div | ||
| class="lg:text-6xl text-5xl tracking-tighter font-mono leading-tight" | ||
| :style="{ lineClamp: 2, textOverflow: 'ellipsis' }" | ||
| > | ||
| {{ title }} | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Authors --> | ||
| <div v-if="authors.length" class="flex items-center gap-4 flex-nowrap"> | ||
| <!-- Stacked avatars --> | ||
| <span class="flex flex-row items-center"> | ||
| <span | ||
| v-for="(author, index) in visibleAuthors" | ||
| :key="author.name" | ||
| class="flex items-center justify-center rounded-full border border-bg bg-bg-muted overflow-hidden w-12 h-12" | ||
| :style="{ marginLeft: index > 0 ? '-20px' : '0' }" | ||
| > | ||
| <img | ||
| v-if="author.avatar" | ||
| :src="author.avatar" | ||
| :alt="author.name" | ||
| width="48" | ||
| height="48" | ||
| class="w-full h-full object-cover" | ||
| /> | ||
| <span v-else class="text-5 text-fg-muted font-medium"> | ||
| {{ getInitials(author.name) }} | ||
| </span> | ||
| </span> | ||
| <!-- +N badge --> | ||
| <span | ||
| v-if="extraCount > 0" | ||
| class="flex items-center justify-center text-lg font-medium text-fg-muted rounded-full border border-bg bg-bg-muted overflow-hidden w-12 h-12" | ||
| :style="{ marginLeft: '-20px' }" | ||
| > | ||
| +{{ extraCount }} | ||
| </span> | ||
| </span> | ||
| <!-- Names --> | ||
| <span class="text-6 text-fg-muted font-light">{{ formattedAuthorNames }}</span> | ||
| </div> | ||
| </div> | ||
| </OgLayout> | ||
| </template> | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 105
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 341
🏁 Script executed:
cat -n ./app/components/OgImage/BlogPost.takumi.vue | head -40Repository: npmx-dev/npmx.dev
Length of output: 1087
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 443
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 43
🏁 Script executed:
# Read the entire file to check for imports and overall structure cat ./app/components/OgImage/BlogPost.takumi.vueRepository: npmx-dev/npmx.dev
Length of output: 3322
Add missing import for
computed, and fix invalid date handling with UTC consistency.The
computedfunction is used but not imported from 'vue', so this code will not work. Additionally, line 17 will not throw for an invalidDate, so thecatchblock never executes and this can renderInvalid Date. For server-side OG image rendering, omittingtimeZone: 'UTC'can also shift the calendar day across environments.Suggested change
📝 Committable suggestion