[FEAT] Fix vue warn

This commit is contained in:
2025-11-26 17:16:52 +01:00
parent 09c77f5414
commit accea99408
6 changed files with 148 additions and 137 deletions

View File

@@ -1,11 +1,10 @@
<script setup lang="ts">
import { onMounted } from 'vue';
import { useSEO } from '../composables/useSEO';
import { useStructuredData } from '../composables/useStructuredData';
const { addBreadcrumbSchema } = useStructuredData();
onMounted(() => {
// Set SEO synchronously
useSEO({
title: 'About Us - Our Mission & Story',
description: 'Learn about Spritesheet Generator, a free tool designed to help game developers and artists streamline their workflow with optimized spritesheet creation.',
@@ -18,7 +17,6 @@
{ name: 'Home', url: '/' },
{ name: 'About Us', url: '/about' }
]);
});
</script>
<template>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue';
import { ref, onMounted, watch, computed } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useBlog, type BlogPost } from '../composables/useBlog';
import { useSEO } from '../composables/useSEO';
@@ -13,45 +13,63 @@
const post = ref<BlogPost | undefined>(undefined);
const renderedContent = ref('');
onMounted(async () => {
const slug = route.params.slug as string;
post.value = await getPost(slug);
const slug = computed(() => route.params.slug as string);
if (post.value) {
renderedContent.value = await marked(post.value.content);
// Set SEO meta tags
// Initialize with default SEO (will be updated when post loads)
useSEO({
title: post.value.title,
description: post.value.description,
image: post.value.image,
url: `/blog/${slug}`,
title: 'Blog Post',
description: 'Read our latest article about spritesheet generation and game development.',
url: `/blog/${slug.value}`,
type: 'article',
author: post.value.author || 'nu11ed',
publishedTime: post.value.date,
keywords: post.value.keywords || 'sprite sheet, game development, blog'
keywords: 'sprite sheet, game development, blog'
});
// Add structured data
addBlogPostSchema({
title: post.value.title,
description: post.value.description,
author: post.value.author || 'nu11ed',
datePublished: post.value.date,
image: post.value.image,
url: `/blog/${slug}`
});
// Add breadcrumb
addBreadcrumbSchema([
{ name: 'Home', url: '/' },
{ name: 'Blog', url: '/blog' },
{ name: post.value.title, url: `/blog/${slug}` }
{ name: 'Article', url: `/blog/${slug.value}` }
]);
onMounted(async () => {
post.value = await getPost(slug.value);
if (post.value) {
renderedContent.value = await marked(post.value.content);
} else {
router.push({ name: 'blog-overview' });
}
});
// Update SEO and structured data when post loads
watch(post, (newPost) => {
if (newPost) {
useSEO({
title: newPost.title,
description: newPost.description,
image: newPost.image,
url: `/blog/${slug.value}`,
type: 'article',
author: newPost.author || 'nu11ed',
publishedTime: newPost.date,
keywords: newPost.keywords || 'sprite sheet, game development, blog'
});
addBlogPostSchema({
title: newPost.title,
description: newPost.description,
author: newPost.author || 'nu11ed',
datePublished: newPost.date,
image: newPost.image,
url: `/blog/${slug.value}`
});
addBreadcrumbSchema([
{ name: 'Home', url: '/' },
{ name: 'Blog', url: '/blog' },
{ name: newPost.title, url: `/blog/${slug.value}` }
]);
}
});
</script>
<template>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ref, onMounted, watch } from 'vue';
import { useBlog, type BlogPost } from '../composables/useBlog';
import { useSEO } from '../composables/useSEO';
import { useStructuredData } from '../composables/useStructuredData';
@@ -9,10 +9,7 @@
const { addBlogListSchema, addBreadcrumbSchema } = useStructuredData();
const posts = ref<BlogPost[]>([]);
onMounted(async () => {
posts.value = await getPosts();
// Set SEO meta tags
// Set SEO meta tags synchronously
useSEO({
title: 'Blog - Latest Articles on Spritesheet Generation',
description: 'Explore our latest articles about sprite sheet generation, game development, pixel art, and sprite animation techniques.',
@@ -21,10 +18,21 @@
keywords: 'sprite sheet blog, game development articles, pixel art tutorials, sprite animation'
});
// Add blog list structured data
if (posts.value.length > 0) {
// Add breadcrumb synchronously
addBreadcrumbSchema([
{ name: 'Home', url: '/' },
{ name: 'Blog', url: '/blog' }
]);
onMounted(async () => {
posts.value = await getPosts();
});
// Watch posts and add structured data when available
watch(posts, (newPosts) => {
if (newPosts.length > 0) {
addBlogListSchema(
posts.value.map(post => ({
newPosts.map(post => ({
title: post.title,
description: post.description,
author: post.author || 'nu11ed',
@@ -34,13 +42,7 @@
}))
);
}
// Add breadcrumb
addBreadcrumbSchema([
{ name: 'Home', url: '/' },
{ name: 'Blog', url: '/blog' }
]);
});
}, { immediate: true });
</script>
<template>

View File

@@ -1,11 +1,10 @@
<script setup lang="ts">
import { onMounted } from 'vue';
import { useSEO } from '../composables/useSEO';
import { useStructuredData } from '../composables/useStructuredData';
const { addBreadcrumbSchema } = useStructuredData();
onMounted(() => {
// Set SEO synchronously
useSEO({
title: 'Contact Us - Get in Touch',
description: 'Contact the Spritesheet Generator team. Join our Discord community or report bugs and contribute on Gitea. We\'d love to hear from you!',
@@ -18,7 +17,6 @@
{ name: 'Home', url: '/' },
{ name: 'Contact', url: '/contact' }
]);
});
</script>
<template>

View File

@@ -1,4 +1,3 @@
import { onMounted } from 'vue';
import { useSEO } from '../composables/useSEO';
import { useStructuredData } from '../composables/useStructuredData';
import { useHead } from '@vueuse/head';
@@ -6,8 +5,7 @@ import { useHead } from '@vueuse/head';
export function useHomeViewSEO() {
const { addOrganizationSchema, addWebSiteSchema } = useStructuredData();
onMounted(() => {
// Set page SEO
// Set page SEO synchronously
useSEO({
title: 'Spritesheet Generator - Create Game Spritesheets Online',
description: 'Free online tool to create spritesheets for game development. Upload sprites, arrange them, and export as a spritesheet with animation preview.',
@@ -61,5 +59,4 @@ export function useHomeViewSEO() {
}
]
});
});
}

View File

@@ -1,11 +1,10 @@
<script setup lang="ts">
import { onMounted } from 'vue';
import { useSEO } from '../composables/useSEO';
import { useStructuredData } from '../composables/useStructuredData';
const { addBreadcrumbSchema } = useStructuredData();
onMounted(() => {
// Set SEO synchronously
useSEO({
title: 'Privacy Policy - Your Data Protection',
description: 'Read our privacy policy. Spritesheet Generator is a client-side tool that does not collect personal data or upload your images to our servers.',
@@ -18,7 +17,6 @@
{ name: 'Home', url: '/' },
{ name: 'Privacy Policy', url: '/privacy-policy' }
]);
});
</script>
<template>