feat: add meta descriptions
This commit is contained in:
parent
74cad85292
commit
7ec729ba66
@ -2,9 +2,14 @@
|
|||||||
* Set the page title in the format [title] | Eggworld.
|
* Set the page title in the format [title] | Eggworld.
|
||||||
* @param title The title string.
|
* @param title The title string.
|
||||||
*/
|
*/
|
||||||
export function useTitle(title: string) {
|
export function useTitle(title: string, description?: string) {
|
||||||
useHead({
|
useHead({
|
||||||
title: `${title} | Eggworld`,
|
title: `${title} | Eggworld`,
|
||||||
|
meta: [
|
||||||
|
{ name: "viewport", content: " width=device-width,initial-scale=1" },
|
||||||
|
{ name: "description", content: description || "" },
|
||||||
|
{ name: "theme-color", content: "#ffffff" },
|
||||||
|
],
|
||||||
link: [
|
link: [
|
||||||
{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
|
{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ const descText =
|
|||||||
type === "stories"
|
type === "stories"
|
||||||
? `${calcReadingTime(doc).words.total} words`
|
? `${calcReadingTime(doc).words.total} words`
|
||||||
: `${calcReadingTime(doc).minutes} min read`;
|
: `${calcReadingTime(doc).minutes} min read`;
|
||||||
useTitle(doc.title);
|
useTitle(doc.title, doc.description);
|
||||||
|
|
||||||
const captionText =
|
const captionText =
|
||||||
type === "stories" ? "Story" : type === "blog" ? "Blog post" : "";
|
type === "stories" ? "Story" : type === "blog" ? "Blog post" : "";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { BlogParsedContent } from "@/shared/types";
|
import type { BlogParsedContent } from "@/shared/types";
|
||||||
|
|
||||||
useTitle("Blog");
|
useTitle("Blog", "Ramblings and ideas");
|
||||||
definePageMeta({ layout: "withtop" });
|
definePageMeta({ layout: "withtop" });
|
||||||
|
|
||||||
// TODO: paginate stories
|
// TODO: paginate stories
|
||||||
|
@ -3,7 +3,7 @@ import Services from "@/components/index/services.vue";
|
|||||||
import About from "@/components/index/about.vue";
|
import About from "@/components/index/about.vue";
|
||||||
|
|
||||||
definePageMeta({ layout: "withtop" });
|
definePageMeta({ layout: "withtop" });
|
||||||
useTitle("Home");
|
useTitle("Home", "Personal website!");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { StoryParsedContent } from "@/shared/types";
|
import type { StoryParsedContent } from "@/shared/types";
|
||||||
|
|
||||||
useTitle("Stories");
|
useTitle("Stories", "Fantasies and worlds");
|
||||||
definePageMeta({ layout: "withtop" });
|
definePageMeta({ layout: "withtop" });
|
||||||
|
|
||||||
// TODO: paginate stories
|
// TODO: paginate stories
|
||||||
|
@ -14,6 +14,9 @@ const docs = await queryContent<BlogParsedContent>("/blog")
|
|||||||
.sort({ date: -1 })
|
.sort({ date: -1 })
|
||||||
.where({ _draft: false, tags: { $contains: tag } })
|
.where({ _draft: false, tags: { $contains: tag } })
|
||||||
.find();
|
.find();
|
||||||
|
|
||||||
|
const title = `${details.name ?? `"${tag}"`} Posts`;
|
||||||
|
useTitle(title, details.description);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -21,7 +24,7 @@ const docs = await queryContent<BlogParsedContent>("/blog")
|
|||||||
class="prose dark:prose-invert max-w-3xl flex flex-col grow gap-6 transition"
|
class="prose dark:prose-invert max-w-3xl flex flex-col grow gap-6 transition"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<h1 class="mb-0">{{ details.name ?? `"${tag}"` }} Posts</h1>
|
<h1 class="mb-0">{{ title }}</h1>
|
||||||
<p
|
<p
|
||||||
v-if="details.description"
|
v-if="details.description"
|
||||||
v-html="details.description"
|
v-html="details.description"
|
||||||
|
@ -14,6 +14,9 @@ const docs = await queryContent<StoryParsedContent>("/stories")
|
|||||||
.sort({ date: -1 })
|
.sort({ date: -1 })
|
||||||
.where({ _draft: false, tags: { $contains: tag } })
|
.where({ _draft: false, tags: { $contains: tag } })
|
||||||
.find();
|
.find();
|
||||||
|
|
||||||
|
const title = `${details.name ?? `"${tag}"`} Stories`;
|
||||||
|
useTitle(title, details.description);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -21,7 +24,7 @@ const docs = await queryContent<StoryParsedContent>("/stories")
|
|||||||
class="prose dark:prose-invert max-w-3xl flex flex-col grow gap-6 transition"
|
class="prose dark:prose-invert max-w-3xl flex flex-col grow gap-6 transition"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<h1 class="mb-0">{{ details.name ?? `"${tag}"` }} Stories</h1>
|
<h1 class="mb-0">{{ title }} Stories</h1>
|
||||||
<p
|
<p
|
||||||
v-if="details.description"
|
v-if="details.description"
|
||||||
v-html="details.description"
|
v-html="details.description"
|
||||||
|
Loading…
Reference in New Issue
Block a user