remove html tags from meta tags
This commit is contained in:
parent
2f47860046
commit
9c5bc00657
7
src/lib/js/stripHtmlTags.ts
Normal file
7
src/lib/js/stripHtmlTags.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// Function to strip HTML tags from a string
|
||||||
|
function stripHtmlTags(input) {
|
||||||
|
const parser = new DOMParser();
|
||||||
|
const doc = parser.parseFromString(input, 'text/html');
|
||||||
|
const textContent = doc.body.textContent || "";
|
||||||
|
return textContent;
|
||||||
|
}
|
@ -11,6 +11,7 @@
|
|||||||
import { afterNavigate } from '$app/navigation';
|
import { afterNavigate } from '$app/navigation';
|
||||||
import {season} from '$lib/js/season_store';
|
import {season} from '$lib/js/season_store';
|
||||||
import RecipeNote from '$lib/components/RecipeNote.svelte';
|
import RecipeNote from '$lib/components/RecipeNote.svelte';
|
||||||
|
import {stripHtmlTags} from '$lib/js/stripHtmlTags';
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
@ -206,12 +207,12 @@ h4{
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>Bocken - {@html data.name}</title>
|
<title>Bocken - {stripHtmlTags(data.name)}</title>
|
||||||
<meta name="description" content="{data.description}" />
|
<meta name="description" content="{stripHtmlTags(data.description)}" />
|
||||||
<meta property="og:image" content="https://bocken.org/static/rezepte/thumb/{data.short_name}.webp" />
|
<meta property="og:image" content="https://bocken.org/static/rezepte/thumb/{data.short_name}.webp" />
|
||||||
<meta property="og:image:secure_url" content="https://bocken.org/static/rezepte/thumb/{data.short_name}.webp" />
|
<meta property="og:image:secure_url" content="https://bocken.org/static/rezepte/thumb/{data.short_name}.webp" />
|
||||||
<meta property="og:image:type" content="image/webp" />
|
<meta property="og:image:type" content="image/webp" />
|
||||||
<meta property="og:image:alt" content="{@html data.name}" />
|
<meta property="og:image:alt" content="{stripHtmlTags(data.name)}" />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<TitleImgParallax src={hero_img_src} {placeholder_src}>
|
<TitleImgParallax src={hero_img_src} {placeholder_src}>
|
||||||
|
Loading…
Reference in New Issue
Block a user