Skip to content

Commit

Permalink
feat: add og-image
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 5, 2023
1 parent ee96452 commit 396af45
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 21 deletions.
5 changes: 3 additions & 2 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const SidebarConfig: DefaultTheme.SidebarItem[] = [
]

const ogUrl = 'https://unocss.dev/'
const ogImage = `${ogUrl}og-image.png`
const ogImage = `${ogUrl}og.png`
const title = 'UnoCSS'
const description = 'The instant on-demand Atomic CSS engine'

Expand All @@ -223,7 +223,7 @@ export default defineConfig({
description,
outDir: './dist',
head: [
['link', { rel: 'icon', href: '/logo.svg', type: 'image/svg+xml' }],
['link', { rel: 'icon', href: '/favicon.svg', type: 'image/svg+xml' }],
['link', { rel: 'alternate icon', href: '/favicon.ico', type: 'image/png', sizes: '16x16' }],
['meta', { name: 'author', content: 'Anthony Fu' }],
['meta', { property: 'og:type', content: 'website' }],
Expand All @@ -235,6 +235,7 @@ export default defineConfig({
['meta', { name: 'twitter:image', content: ogImage }],
['meta', { name: 'twitter:site', content: '@antfu7' }],
['meta', { name: 'twitter:url', content: ogUrl }],
['link', { rel: 'search', type: 'application/opensearchdescription+xml', href: '/search.xml', title: 'UnoCSS' }],
],
lastUpdated: true,
cleanUrls: true,
Expand Down
Binary file removed docs/public/cover/default.png
Binary file not shown.
File renamed without changes
8 changes: 4 additions & 4 deletions docs/public/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/og.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
9 changes: 9 additions & 0 deletions docs/public/search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>UnoCSS</ShortName>
<Description>UnoCSS Interactive Docs</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="192" height="192">https://unocss.dev/favicon.svg</Image>
<Image width="512" height="512">https://unocss.dev/favicon.svg</Image>
<Image width="16" height="16">https://unocss.dev/favicon.svg</Image>
<Url type="text/html" template="https://unocss.dev/interactive/?s={searchTerms}"/>
</OpenSearchDescription>
22 changes: 17 additions & 5 deletions interactive/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,27 @@ import '@unocss/reset/antfu.css'
import './markdown.css'
import 'uno.css'
const ogUrl = 'https://unocss.dev/'
const ogImage = `${ogUrl}og.png`
const title = 'UnoCSS Interactive Docs'
const description = 'The instant on-demand Atomic CSS engine'
useHead({
title: 'UnoCSS Interactive Docs',
title,
htmlAttrs: [
{ lang: 'en-US' },
],
meta: [{
name: 'description',
content: 'UnoCSS Interactive Docs',
}],
meta: [
{ property: 'og:type', content: 'website' },
{ name: 'og:title', content: title },
{ name: 'og:description', content: description },
{ property: 'og:image', content: ogImage },
{ name: 'twitter:title', content: title },
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:image', content: ogImage },
{ name: 'twitter:site', content: '@antfu7' },
{ name: 'twitter:url', content: ogUrl },
],
link: [
{ rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' },
{ rel: 'search', type: 'application/opensearchdescription+xml', href: '/search.xml', title: 'UnoCSS' },
Expand Down
9 changes: 0 additions & 9 deletions interactive/public/search.xml

This file was deleted.

12 changes: 11 additions & 1 deletion playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>UnoCSS Playground</title>
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<meta property="og:type" content="website">
<meta name="og:title" content="UnoCSS Playground">
<meta name="og:description" content="The instant on-demand Atomic CSS engine">
<meta property="og:image" content="https://unocss.dev/og.png">
<meta name="twitter:title" content="UnoCSS Playground">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://unocss.dev/og.png">
<meta name="twitter:site" content="@antfu7">
<meta name="twitter:url" content="https://unocss.dev/playground/">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="search" type="application/opensearchdescription+xml" href="/search.xml" title="UnoCSS">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;400&family=Fira+Code&display=swap" rel="stylesheet" />
Expand Down

0 comments on commit 396af45

Please sign in to comment.