mirror of
https://github.com/jaronpate/folio.git
synced 2026-10-19 01:07:39 +00:00
consolidate title and description vars
This commit is contained in:
+1
-1
@@ -181,7 +181,7 @@ definePageMeta({
|
|||||||
<template>
|
<template>
|
||||||
<NuxtLayout name="main"
|
<NuxtLayout name="main"
|
||||||
title="Hey, I'm Jaron"
|
title="Hey, I'm Jaron"
|
||||||
description="I build software for a living, but also other things">
|
:description="DEFAULT_DESCRIPTION">
|
||||||
<article>
|
<article>
|
||||||
<h3>Selected Work</h3>
|
<h3>Selected Work</h3>
|
||||||
<template v-for="work in selectedWorks" :key="work.title">
|
<template v-for="work in selectedWorks" :key="work.title">
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ if (!data.value) {
|
|||||||
const page = computed(() => data.value?.project ?? null);
|
const page = computed(() => data.value?.project ?? null);
|
||||||
const isFolder = computed(() => data.value?.kind === 'folder');
|
const isFolder = computed(() => data.value?.kind === 'folder');
|
||||||
const projectTitle = page.value?.title ?? folderName.value;
|
const projectTitle = page.value?.title ?? folderName.value;
|
||||||
const projectDescription = page.value?.description ?? '';
|
const projectDescription = page.value
|
||||||
|
? page.value.description
|
||||||
|
: `Projects from ${folderName.value}`;
|
||||||
const liveHref = computed(() => page.value?.href ?? '');
|
const liveHref = computed(() => page.value?.href ?? '');
|
||||||
const ogImage = projectOgImage(
|
const ogImage = projectOgImage(
|
||||||
page.value?.image,
|
page.value?.image,
|
||||||
@@ -70,15 +72,15 @@ const ogImage = projectOgImage(
|
|||||||
useSeoMeta({
|
useSeoMeta({
|
||||||
title: projectTitle,
|
title: projectTitle,
|
||||||
ogTitle: projectTitle,
|
ogTitle: projectTitle,
|
||||||
description: projectDescription || projectTitle,
|
description: projectDescription,
|
||||||
ogDescription: projectDescription || projectTitle,
|
ogDescription: projectDescription,
|
||||||
ogUrl: pageUrl,
|
ogUrl: pageUrl,
|
||||||
ogType: isFolder.value ? 'website' : 'article',
|
ogType: isFolder.value ? 'website' : 'article',
|
||||||
ogImage,
|
ogImage,
|
||||||
ogImageAlt: projectTitle,
|
ogImageAlt: projectTitle,
|
||||||
twitterCard: 'summary',
|
twitterCard: 'summary',
|
||||||
twitterTitle: projectTitle,
|
twitterTitle: projectTitle,
|
||||||
twitterDescription: projectDescription || projectTitle,
|
twitterDescription: projectDescription,
|
||||||
twitterImage: ogImage,
|
twitterImage: ogImage,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -170,9 +172,7 @@ definePageMeta({
|
|||||||
<NuxtLayout
|
<NuxtLayout
|
||||||
name="main"
|
name="main"
|
||||||
:title="page ? page.title : folderName"
|
:title="page ? page.title : folderName"
|
||||||
:description="
|
:description="projectDescription"
|
||||||
page ? page.description : `Projects from ${folderName}`
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<article v-if="page">
|
<article v-if="page">
|
||||||
<div class="article-body">
|
<div class="article-body">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const collectionId = `${projectsUrl}#collection`;
|
|||||||
const listId = `${projectsUrl}#list`;
|
const listId = `${projectsUrl}#list`;
|
||||||
const projectsTitle = 'Projects';
|
const projectsTitle = 'Projects';
|
||||||
const projectsDescription =
|
const projectsDescription =
|
||||||
"Things I've made. Some for work, some because I wanted them to exist.";
|
"Things I've made which you may find of some interest.";
|
||||||
|
|
||||||
useSeoMeta({
|
useSeoMeta({
|
||||||
title: projectsTitle,
|
title: projectsTitle,
|
||||||
@@ -111,8 +111,8 @@ definePageMeta({
|
|||||||
<template>
|
<template>
|
||||||
<NuxtLayout
|
<NuxtLayout
|
||||||
name="main"
|
name="main"
|
||||||
title="Projects"
|
:title="projectsTitle"
|
||||||
description="Things I've made which you may find of some interest."
|
:description="projectsDescription"
|
||||||
>
|
>
|
||||||
<article>
|
<article>
|
||||||
<ProjectList :pages="pages ?? []" />
|
<ProjectList :pages="pages ?? []" />
|
||||||
|
|||||||
@@ -54,20 +54,33 @@ if (!data.value) {
|
|||||||
const page = computed(() => data.value?.article ?? null);
|
const page = computed(() => data.value?.article ?? null);
|
||||||
const isFolder = computed(() => data.value?.kind === 'folder');
|
const isFolder = computed(() => data.value?.kind === 'folder');
|
||||||
const articleTitle = page.value?.title ?? folderName.value;
|
const articleTitle = page.value?.title ?? folderName.value;
|
||||||
const articleDescription = page.value?.description ?? '';
|
const formatDate = (date: Date | string) => {
|
||||||
|
return new Date(date).toLocaleDateString('en-US', {
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
year: 'numeric',
|
||||||
|
timeZone: 'UTC',
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const articleDescription = page.value
|
||||||
|
? page.value.description
|
||||||
|
: `Writing from ${folderName.value}`;
|
||||||
|
const layoutDescription = page.value
|
||||||
|
? formatDate(page.value.date)
|
||||||
|
: articleDescription;
|
||||||
|
|
||||||
useSeoMeta({
|
useSeoMeta({
|
||||||
title: articleTitle,
|
title: articleTitle,
|
||||||
ogTitle: articleTitle,
|
ogTitle: articleTitle,
|
||||||
description: articleDescription || articleTitle,
|
description: articleDescription,
|
||||||
ogDescription: articleDescription || articleTitle,
|
ogDescription: articleDescription,
|
||||||
ogUrl: articleUrl,
|
ogUrl: articleUrl,
|
||||||
ogType: isFolder.value ? 'website' : 'article',
|
ogType: isFolder.value ? 'website' : 'article',
|
||||||
ogImage: DEFAULT_IMAGE,
|
ogImage: DEFAULT_IMAGE,
|
||||||
ogImageAlt: articleTitle,
|
ogImageAlt: articleTitle,
|
||||||
twitterCard: 'summary',
|
twitterCard: 'summary',
|
||||||
twitterTitle: articleTitle,
|
twitterTitle: articleTitle,
|
||||||
twitterDescription: articleDescription || articleTitle,
|
twitterDescription: articleDescription,
|
||||||
twitterImage: DEFAULT_IMAGE,
|
twitterImage: DEFAULT_IMAGE,
|
||||||
articlePublishedTime: page.value
|
articlePublishedTime: page.value
|
||||||
? new Date(page.value.date).toISOString()
|
? new Date(page.value.date).toISOString()
|
||||||
@@ -175,15 +188,6 @@ useHead({
|
|||||||
: [],
|
: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const formatDate = (date: Date | string) => {
|
|
||||||
return new Date(date).toLocaleDateString('en-US', {
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
year: 'numeric',
|
|
||||||
timeZone: 'UTC',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
layout: false,
|
layout: false,
|
||||||
});
|
});
|
||||||
@@ -193,7 +197,7 @@ definePageMeta({
|
|||||||
<NuxtLayout
|
<NuxtLayout
|
||||||
name="main"
|
name="main"
|
||||||
:title="page ? page.title : folderName"
|
:title="page ? page.title : folderName"
|
||||||
:description="page ? formatDate(page.date) : `Writing from ${folderName}`"
|
:description="layoutDescription"
|
||||||
>
|
>
|
||||||
<article v-if="page">
|
<article v-if="page">
|
||||||
<div class="article-body">
|
<div class="article-body">
|
||||||
|
|||||||
@@ -121,8 +121,8 @@ definePageMeta({
|
|||||||
<template>
|
<template>
|
||||||
<NuxtLayout
|
<NuxtLayout
|
||||||
name="main"
|
name="main"
|
||||||
title="Writing"
|
:title="writingTitle"
|
||||||
description="Thoughts I've had here and there. Maybe you'll find something helpful or interesting here."
|
:description="writingDescription"
|
||||||
>
|
>
|
||||||
<article>
|
<article>
|
||||||
<WritingList :pages="pages ?? []" />
|
<WritingList :pages="pages ?? []" />
|
||||||
|
|||||||
Reference in New Issue
Block a user