Updated <head> (again)

This commit is contained in:
Simon Cambier 2023-11-26 11:28:06 +01:00
parent ac53680831
commit 291eb3dbce
4 changed files with 5 additions and 20 deletions

View File

@ -12,10 +12,12 @@
npm/codemirror@5.65.16/lib/codemirror.min.css,
npm/codemirror@5.65.16/theme/nord.min.css"
/>
<script async src="https://stats.scambier.xyz/script.js" data-website-id="c78680ff-ef20-43a4-b204-32721cf679f5"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="Paste - No-database paste service" />
<meta property="og:url" content="https://paste.scambier.xyz" />
<meta property="og:type" content="article" />
<meta name="description" property="og:description" content="Paste is a client-side paste service with no database, and no back-end code. The data is stored entirely in the shared link" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">

View File

@ -34,6 +34,3 @@ export function getLangFromUrl() {
export const byId = (id: string) => document.getElementById(id)
export const staticMetaDescription =
'Paste is a client-side paste service with no database, and no back-end code. The data is stored entirely in the shared link'

View File

@ -10,22 +10,13 @@
import 'highlight.js/styles/nord.min.css'
import TopBar from '../components/TopBar.svelte'
import Icon from '@iconify/svelte'
import { getLangFromUrl, staticMetaDescription } from '$lib/utils'
import { getLangFromUrl } from '$lib/utils'
let decompressed: string
let htmlContent: string
let isMarkdown = false
let isPlainText = false
// Meta description
$: metaDescription = (() => {
if (decompressed) {
const text = decompressed.slice(0, 100)
return text + (text.length === 100 ? '...' : '')
}
return staticMetaDescription
})()
onMount(async () => {
let lang = getLangFromUrl()
// Remove github flavored markdown, redundant with markdown
@ -96,10 +87,6 @@
{/if}
</div>
<svelte:head>
<meta name="description" property="og:description" content={metaDescription} />
</svelte:head>
<style lang="scss">
:global(pre code.hljs) {
background-color: transparent;

View File

@ -2,7 +2,7 @@
import type { Editor } from 'codemirror'
import { debounce } from 'lodash-es'
import * as brotli from '$lib/brotli'
import { byId, staticMetaDescription } from '$lib/utils'
import { byId } from '$lib/utils'
import TopBar from '../../components/TopBar.svelte'
import { selectedLang, shareUrl } from '../../store'
import EditForm from '../../components/EditForm.svelte'
@ -71,7 +71,6 @@
</script>
<svelte:head>
<meta name="description" property="og:description" content={staticMetaDescription} />
<script
src="https://cdn.jsdelivr.net/combine/
npm/codemirror@5.65.16,