Skip to content

Commit cb8344c

Browse files
committed
fix: use updated twitter card renderer
1 parent d78c5f1 commit cb8344c

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

client/app.vue

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import JsonEditorVue from 'json-editor-vue'
44
import 'vanilla-jsoneditor/themes/jse-theme-dark.css'
55
import { Pane, Splitpanes } from 'splitpanes'
66
import { useLocalStorage, useWindowSize } from '@vueuse/core'
7-
import { joinURL, parseURL, withQuery } from 'ufo'
7+
import { joinURL, parseURL, withHttps, withQuery } from 'ufo'
88
import { ref } from 'vue'
99
import defu from 'defu'
1010
import type { OgImageComponent, OgImageOptions } from '../src/runtime/types'
@@ -147,7 +147,7 @@ const socialPreviewDescription = computed(() => {
147147
148148
const socialSiteUrl = computed(() => {
149149
// need to turn this URL into just an origin
150-
return parseURL(debug.value?.siteConfig?.url || '/').host || debug.value?.siteConfig?.url
150+
return parseURL(debug.value?.siteConfig?.url || '/').host || debug.value?.siteConfig?.url || '/'
151151
})
152152
const slackSocialPreviewSiteName = computed(() => {
153153
return options.value?.socialPreview?.og.site_name || socialSiteUrl.value
@@ -434,8 +434,11 @@ const currentPageFile = computed(() => {
434434
</div>
435435
</div>
436436
<TwitterCardRenderer v-if="socialPreview === 'twitter'">
437+
<template #title>
438+
{{ socialPreviewTitle }}
439+
</template>
437440
<template #domain>
438-
{{ socialSiteUrl }}
441+
<a target="_blank" :href="withHttps(socialSiteUrl)">From {{ socialSiteUrl }}</a>
439442
</template>
440443
<ImageLoader
441444
v-if="imageFormat !== 'html'"

client/components/TwitterCardRenderer.vue

+29-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
<slot />
99
</div>
1010
</div>
11-
<div class="domain absolute bottom-3 bg-black/20 z-2 left-3 text-white">
11+
<div class="title absolute bottom-3 z-2 left-3 text-white">
12+
<slot name="title" />
13+
</div>
14+
<div class="domain absolute -bottom-5 z-2 left-3">
1215
<slot name="domain" />
1316
</div>
1417
</div>
@@ -21,7 +24,30 @@
2124
opacity: 1;
2225
height: 300px;
2326
}
27+
.domain:hover {
28+
text-decoration: underline;
29+
}
2430
.domain {
31+
line-height: 16px;
32+
cursor: pointer;
33+
min-width: 0px;
34+
word-wrap: break-word;
35+
text-overflow: unset;
36+
color: rgb(83, 100, 113);
37+
font-weight: 400;
38+
background-color: rgba(0,0,0,0.00);
39+
border: 0 solid black;
40+
box-sizing: border-box;
41+
display: inline;
42+
font: 14px -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
43+
list-style: none;
44+
margin: 0px;
45+
padding: 0px;
46+
text-align: inherit;
47+
text-decoration: none;
48+
white-space: pre-wrap;
49+
}
50+
.title {
2551
word-wrap: break-word;
2652
text-overflow: unset;
2753
min-width: 0px;
@@ -32,6 +58,8 @@
3258
text-align: center;
3359
height: 20px;
3460
padding: 0 4px;
61+
border-radius: 4px;
62+
background-color: rgba(0, 0, 0, 0.77);
3563
}
3664
.root {
3765
outline-style: none;

0 commit comments

Comments
 (0)