SEO blog post V2
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -77,6 +77,11 @@ meta-fix.js
|
||||
read-inbox.mjs
|
||||
quora_antwort_statisch_dynamisch.txt
|
||||
|
||||
# Local blog audit reports and temporary snapshots
|
||||
scratch_blog_analysis.json
|
||||
scratch_scored_blog_posts.json
|
||||
src/lib/blog-data.snapshot-*.ts
|
||||
|
||||
# Local developer-package workspaces and unreferenced generated media
|
||||
/packages/
|
||||
/public/Events/
|
||||
|
||||
5569
package-lock.json
generated
5569
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,97 +1,99 @@
|
||||
import React from 'react';
|
||||
import type { Metadata } from 'next';
|
||||
import Link from 'next/link';
|
||||
import Image from 'next/image';
|
||||
import SeoJsonLd from '@/components/SeoJsonLd';
|
||||
import { websiteSchema, breadcrumbSchema } from '@/lib/schema';
|
||||
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/Card';
|
||||
import { Badge } from '@/components/ui/Badge';
|
||||
import Breadcrumbs, { BreadcrumbItem } from '@/components/Breadcrumbs';
|
||||
import { blogPosts } from '@/lib/blog-data';
|
||||
|
||||
// Enable Incremental Static Regeneration (ISR)
|
||||
// Revalidate every hour
|
||||
export const revalidate = 3600;
|
||||
|
||||
function truncateAtWord(text: string, maxLength: number): string {
|
||||
if (text.length <= maxLength) return text;
|
||||
const truncated = text.slice(0, maxLength);
|
||||
const lastSpace = truncated.lastIndexOf(' ');
|
||||
return lastSpace > 0 ? truncated.slice(0, lastSpace) : truncated;
|
||||
}
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const title = truncateAtWord('QR Insights: Latest QR Strategies', 60);
|
||||
const description = truncateAtWord(
|
||||
'Expert guides on QR code strategies, marketing campaigns, tracking analytics, and best practices for small businesses and enterprises.',
|
||||
160
|
||||
);
|
||||
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
alternates: {
|
||||
canonical: 'https://www.qrmaster.net/blog',
|
||||
languages: {
|
||||
'x-default': 'https://www.qrmaster.net/blog',
|
||||
en: 'https://www.qrmaster.net/blog',
|
||||
},
|
||||
},
|
||||
openGraph: {
|
||||
title,
|
||||
description,
|
||||
url: 'https://www.qrmaster.net/blog',
|
||||
type: 'website',
|
||||
images: ['/og-image.png'],
|
||||
},
|
||||
twitter: {
|
||||
title,
|
||||
description,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function BlogPage() {
|
||||
const breadcrumbItems: BreadcrumbItem[] = [
|
||||
{ name: 'Home', url: '/' },
|
||||
{ name: 'Blog', url: '/blog' },
|
||||
];
|
||||
|
||||
// Filter posts to only show those published in the past or today
|
||||
// sort by date descending (newest first)
|
||||
const currentDate = new Date();
|
||||
|
||||
const publishedPosts = blogPosts
|
||||
.filter(post => {
|
||||
const publishDate = post.datePublished ? new Date(post.datePublished) : new Date(post.date);
|
||||
return publishDate <= currentDate;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
const dateA = a.datePublished ? new Date(a.datePublished) : new Date(a.date);
|
||||
const dateB = b.datePublished ? new Date(b.datePublished) : new Date(b.date);
|
||||
return dateB.getTime() - dateA.getTime();
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<SeoJsonLd data={[websiteSchema(), breadcrumbSchema(breadcrumbItems)]} />
|
||||
<div className="py-20 bg-gradient-to-b from-gray-50 to-white">
|
||||
<div className="container mx-auto px-4">
|
||||
<Breadcrumbs items={breadcrumbItems} />
|
||||
<div className="text-center mb-16">
|
||||
<h1 className="text-4xl lg:text-5xl font-bold text-gray-900 mb-6">
|
||||
QR Code Insights
|
||||
</h1>
|
||||
<p className="text-xl text-gray-600 max-w-2xl mx-auto">
|
||||
Expert guides on dynamic QR codes, campaign tracking, UTM analytics, and smart marketing use cases.
|
||||
Discover how-to tutorials and best practices for QR code analytics.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto">
|
||||
{publishedPosts.map((post) => (
|
||||
<Link key={post.slug} href={`/blog/${post.slug}`}>
|
||||
<Card hover className="h-full overflow-hidden shadow-md hover:shadow-xl transition-all duration-300">
|
||||
import React from 'react';
|
||||
import type { Metadata } from 'next';
|
||||
import Link from 'next/link';
|
||||
import Image from 'next/image';
|
||||
import SeoJsonLd from '@/components/SeoJsonLd';
|
||||
import { websiteSchema, breadcrumbSchema } from '@/lib/schema';
|
||||
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/Card';
|
||||
import { Badge } from '@/components/ui/Badge';
|
||||
import Breadcrumbs, { BreadcrumbItem } from '@/components/Breadcrumbs';
|
||||
import { blogPosts } from '@/lib/blog-data';
|
||||
import { REDIRECTED_BLOG_SLUGS } from "@/lib/content";
|
||||
|
||||
// Enable Incremental Static Regeneration (ISR)
|
||||
// Revalidate every hour
|
||||
export const revalidate = 3600;
|
||||
|
||||
function truncateAtWord(text: string, maxLength: number): string {
|
||||
if (text.length <= maxLength) return text;
|
||||
const truncated = text.slice(0, maxLength);
|
||||
const lastSpace = truncated.lastIndexOf(' ');
|
||||
return lastSpace > 0 ? truncated.slice(0, lastSpace) : truncated;
|
||||
}
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const title = truncateAtWord('QR Insights: Latest QR Strategies', 60);
|
||||
const description = truncateAtWord(
|
||||
'Expert guides on QR code strategies, marketing campaigns, tracking analytics, and best practices for small businesses and enterprises.',
|
||||
160
|
||||
);
|
||||
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
alternates: {
|
||||
canonical: 'https://www.qrmaster.net/blog',
|
||||
languages: {
|
||||
'x-default': 'https://www.qrmaster.net/blog',
|
||||
en: 'https://www.qrmaster.net/blog',
|
||||
},
|
||||
},
|
||||
openGraph: {
|
||||
title,
|
||||
description,
|
||||
url: 'https://www.qrmaster.net/blog',
|
||||
type: 'website',
|
||||
images: ['/og-image.png'],
|
||||
},
|
||||
twitter: {
|
||||
title,
|
||||
description,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function BlogPage() {
|
||||
const breadcrumbItems: BreadcrumbItem[] = [
|
||||
{ name: 'Home', url: '/' },
|
||||
{ name: 'Blog', url: '/blog' },
|
||||
];
|
||||
|
||||
// Filter posts to only show those published in the past or today
|
||||
// sort by date descending (newest first)
|
||||
const currentDate = new Date();
|
||||
|
||||
const publishedPosts = blogPosts
|
||||
.filter(post => {
|
||||
if (REDIRECTED_BLOG_SLUGS.has(post.slug)) return false;
|
||||
const publishDate = post.datePublished ? new Date(post.datePublished) : new Date(post.date);
|
||||
return publishDate <= currentDate;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
const dateA = a.datePublished ? new Date(a.datePublished) : new Date(a.date);
|
||||
const dateB = b.datePublished ? new Date(b.datePublished) : new Date(b.date);
|
||||
return dateB.getTime() - dateA.getTime();
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<SeoJsonLd data={[websiteSchema(), breadcrumbSchema(breadcrumbItems)]} />
|
||||
<div className="py-20 bg-gradient-to-b from-gray-50 to-white">
|
||||
<div className="container mx-auto px-4">
|
||||
<Breadcrumbs items={breadcrumbItems} />
|
||||
<div className="text-center mb-16">
|
||||
<h1 className="text-4xl lg:text-5xl font-bold text-gray-900 mb-6">
|
||||
QR Code Insights
|
||||
</h1>
|
||||
<p className="text-xl text-gray-600 max-w-2xl mx-auto">
|
||||
Expert guides on dynamic QR codes, campaign tracking, UTM analytics, and smart marketing use cases.
|
||||
Discover how-to tutorials and best practices for QR code analytics.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto">
|
||||
{publishedPosts.map((post) => (
|
||||
<Link key={post.slug} href={`/blog/${post.slug}`}>
|
||||
<Card hover className="h-full overflow-hidden shadow-md hover:shadow-xl transition-all duration-300">
|
||||
<div className="relative h-56 overflow-hidden">
|
||||
<Image
|
||||
src={post.image}
|
||||
@@ -102,26 +104,26 @@ export default function BlogPage() {
|
||||
className="w-full h-full object-cover transition-transform duration-500 hover:scale-110"
|
||||
/>
|
||||
</div>
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center justify-between mb-3">
|
||||
<Badge variant="info">{post.category}</Badge>
|
||||
<span className="text-sm text-gray-500 font-medium">{post.readTime} read</span>
|
||||
</div>
|
||||
<CardTitle className="text-xl leading-tight mb-3">{post.title}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-0">
|
||||
<p className="text-gray-600 mb-4 leading-relaxed">{post.excerpt}</p>
|
||||
<div className="flex items-center justify-between pt-4 border-t border-gray-100">
|
||||
<p className="text-sm text-gray-500">{post.date}</p>
|
||||
<span className="text-primary-600 text-sm font-medium">Read more →</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center justify-between mb-3">
|
||||
<Badge variant="info">{post.category}</Badge>
|
||||
<span className="text-sm text-gray-500 font-medium">{post.readTime} read</span>
|
||||
</div>
|
||||
<CardTitle className="text-xl leading-tight mb-3">{post.title}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-0">
|
||||
<p className="text-gray-600 mb-4 leading-relaxed">{post.excerpt}</p>
|
||||
<div className="flex items-center justify-between pt-4 border-t border-gray-100">
|
||||
<p className="text-sm text-gray-500">{post.date}</p>
|
||||
<span className="text-primary-600 text-sm font-medium">Read more →</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,306 +1,308 @@
|
||||
import { MetadataRoute } from 'next';
|
||||
import { blogPosts } from '../lib/blog-data';
|
||||
import { pillarMeta } from '../lib/pillar-data';
|
||||
import { authors } from '../lib/author-data';
|
||||
import { industryPages } from '../lib/industry-pages';
|
||||
import {
|
||||
publishedComparisonPages,
|
||||
publishedGuidePages,
|
||||
} from '../lib/pseo-published-pages';
|
||||
import { publishedUseCases } from '../lib/growth-pages';
|
||||
import { useCasePagesDe } from '../lib/growth-pages-de';
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const baseUrl = 'https://www.qrmaster.net';
|
||||
|
||||
// All free tool slugs
|
||||
const freeTools = [
|
||||
'url-qr-code',
|
||||
'vcard-qr-code',
|
||||
'text-qr-code',
|
||||
'email-qr-code',
|
||||
'sms-qr-code',
|
||||
'wifi-qr-code',
|
||||
'crypto-qr-code',
|
||||
'event-qr-code',
|
||||
'facebook-qr-code',
|
||||
'instagram-qr-code',
|
||||
'twitter-qr-code',
|
||||
'youtube-qr-code',
|
||||
'whatsapp-qr-code',
|
||||
'tiktok-qr-code',
|
||||
'geolocation-qr-code',
|
||||
'call-qr-code-generator',
|
||||
'paypal-qr-code',
|
||||
'zoom-qr-code',
|
||||
'teams-qr-code',
|
||||
'google-review-qr-code',
|
||||
'barcode-generator',
|
||||
];
|
||||
|
||||
// All blog posts
|
||||
// Filter out future posts so Google doesn't see them
|
||||
const blogPages = blogPosts
|
||||
.filter((post) => {
|
||||
const publishDate = post.datePublished
|
||||
? new Date(post.datePublished)
|
||||
: new Date(post.date);
|
||||
return publishDate <= new Date();
|
||||
})
|
||||
.map((post) => ({
|
||||
url: `${baseUrl}/blog/${post.slug}`,
|
||||
// Use updatedAt if available, otherwise dateModified or datePublished
|
||||
lastModified: post.updatedAt
|
||||
? new Date(post.updatedAt)
|
||||
: post.dateModified
|
||||
? new Date(post.dateModified)
|
||||
: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
}));
|
||||
|
||||
const highPriorityTools: Record<string, number> = {
|
||||
'barcode-generator': 0.95,
|
||||
'google-review-qr-code': 0.9,
|
||||
};
|
||||
|
||||
const toolLastModified: Record<string, Date> = {
|
||||
'barcode-generator': new Date('2026-05-10'),
|
||||
'vcard-qr-code': new Date('2026-04-27'),
|
||||
'instagram-qr-code': new Date('2026-04-27'),
|
||||
'wifi-qr-code': new Date('2026-04-27'),
|
||||
};
|
||||
|
||||
const toolPages = freeTools.map((slug) => ({
|
||||
url: `${baseUrl}/tools/${slug}`,
|
||||
lastModified: toolLastModified[slug] ?? new Date('2026-01-01'),
|
||||
changeFrequency:
|
||||
slug === 'barcode-generator' ? ('weekly' as const) : ('monthly' as const),
|
||||
priority: highPriorityTools[slug] ?? 0.8,
|
||||
}));
|
||||
|
||||
// Learn hub and pillar pages
|
||||
const learnPages = [
|
||||
{
|
||||
url: `${baseUrl}/learn`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.9,
|
||||
},
|
||||
...pillarMeta.map((pillar) => ({
|
||||
url: `${baseUrl}/learn/${pillar.key}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
})),
|
||||
];
|
||||
|
||||
const industryUrls = industryPages.map((industry) => ({
|
||||
url: `${baseUrl}/qr-code-for/${industry.slug}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.85,
|
||||
}));
|
||||
|
||||
const growthUseCasePages = [
|
||||
{
|
||||
url: `${baseUrl}/use-cases`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/qr-code-for`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.9,
|
||||
},
|
||||
...publishedUseCases.map((useCase) => ({
|
||||
url: `${baseUrl}${useCase.href}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
})),
|
||||
// German pages under /de
|
||||
{
|
||||
url: `${baseUrl}/de/preise`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
},
|
||||
...Object.values(useCasePagesDe).map((useCase) => ({
|
||||
url: `${baseUrl}${useCase.href}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
})),
|
||||
{
|
||||
url: `${baseUrl}/qr-code-for-marketing-campaigns`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.85,
|
||||
},
|
||||
];
|
||||
|
||||
const publishedPseoPages = [
|
||||
...publishedComparisonPages.map((page) => ({
|
||||
url: `${baseUrl}${page.canonicalPath}`,
|
||||
lastModified: new Date('2026-06-22'),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: page.intentStage === 'bottom' ? 0.88 : 0.84,
|
||||
})),
|
||||
...publishedGuidePages.map((page) => ({
|
||||
url: `${baseUrl}${page.canonicalPath}`,
|
||||
lastModified: new Date('2026-06-22'),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.82,
|
||||
})),
|
||||
];
|
||||
|
||||
// Author pages
|
||||
const authorPages = authors.map((author) => ({
|
||||
url: `${baseUrl}/authors/${author.slug}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.7,
|
||||
}));
|
||||
|
||||
return [
|
||||
{
|
||||
url: baseUrl,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 1.0,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/newsletter`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.7,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/restaurants`,
|
||||
lastModified: new Date('2026-04-30'),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/qr-code-erstellen`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 1.0,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/qr-code-tracking`,
|
||||
lastModified: new Date('2026-05-10'),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/qr-code-analytics`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/reprint-calculator`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/dynamic-qr-code-generator`,
|
||||
lastModified: new Date('2026-05-10'),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 0.95,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/dynamic-barcode-generator`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/bulk-qr-code-generator`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/custom-qr-code-generator`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 0.9,
|
||||
},
|
||||
|
||||
{
|
||||
url: `${baseUrl}/pricing`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.8,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/tools`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/features`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.8,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/faq`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.7,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/blog`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 0.8,
|
||||
},
|
||||
|
||||
{
|
||||
url: `${baseUrl}/privacy`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'yearly',
|
||||
priority: 0.4,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/contact`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'yearly',
|
||||
priority: 0.5,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/about`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'yearly',
|
||||
priority: 0.6,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/press`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.7,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/testimonials`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.7,
|
||||
},
|
||||
|
||||
...toolPages,
|
||||
...blogPages,
|
||||
...learnPages,
|
||||
...growthUseCasePages,
|
||||
...publishedPseoPages,
|
||||
...industryUrls,
|
||||
...authorPages,
|
||||
];
|
||||
}
|
||||
import { MetadataRoute } from 'next';
|
||||
import { blogPosts } from '../lib/blog-data';
|
||||
import { REDIRECTED_BLOG_SLUGS } from '../lib/content';
|
||||
import { pillarMeta } from '../lib/pillar-data';
|
||||
import { authors } from '../lib/author-data';
|
||||
import { industryPages } from '../lib/industry-pages';
|
||||
import {
|
||||
publishedComparisonPages,
|
||||
publishedGuidePages,
|
||||
} from '../lib/pseo-published-pages';
|
||||
import { publishedUseCases } from '../lib/growth-pages';
|
||||
import { useCasePagesDe } from '../lib/growth-pages-de';
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const baseUrl = 'https://www.qrmaster.net';
|
||||
|
||||
// All free tool slugs
|
||||
const freeTools = [
|
||||
'url-qr-code',
|
||||
'vcard-qr-code',
|
||||
'text-qr-code',
|
||||
'email-qr-code',
|
||||
'sms-qr-code',
|
||||
'wifi-qr-code',
|
||||
'crypto-qr-code',
|
||||
'event-qr-code',
|
||||
'facebook-qr-code',
|
||||
'instagram-qr-code',
|
||||
'twitter-qr-code',
|
||||
'youtube-qr-code',
|
||||
'whatsapp-qr-code',
|
||||
'tiktok-qr-code',
|
||||
'geolocation-qr-code',
|
||||
'call-qr-code-generator',
|
||||
'paypal-qr-code',
|
||||
'zoom-qr-code',
|
||||
'teams-qr-code',
|
||||
'google-review-qr-code',
|
||||
'barcode-generator',
|
||||
];
|
||||
|
||||
// All blog posts
|
||||
// Filter out future posts so Google doesn't see them
|
||||
const blogPages = blogPosts
|
||||
.filter((post) => {
|
||||
if (REDIRECTED_BLOG_SLUGS.has(post.slug)) return false;
|
||||
const publishDate = post.datePublished
|
||||
? new Date(post.datePublished)
|
||||
: new Date(post.date);
|
||||
return publishDate <= new Date();
|
||||
})
|
||||
.map((post) => ({
|
||||
url: `${baseUrl}/blog/${post.slug}`,
|
||||
// Use updatedAt if available, otherwise dateModified or datePublished
|
||||
lastModified: post.updatedAt
|
||||
? new Date(post.updatedAt)
|
||||
: post.dateModified
|
||||
? new Date(post.dateModified)
|
||||
: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
}));
|
||||
|
||||
const highPriorityTools: Record<string, number> = {
|
||||
'barcode-generator': 0.95,
|
||||
'google-review-qr-code': 0.9,
|
||||
};
|
||||
|
||||
const toolLastModified: Record<string, Date> = {
|
||||
'barcode-generator': new Date('2026-05-10'),
|
||||
'vcard-qr-code': new Date('2026-04-27'),
|
||||
'instagram-qr-code': new Date('2026-04-27'),
|
||||
'wifi-qr-code': new Date('2026-04-27'),
|
||||
};
|
||||
|
||||
const toolPages = freeTools.map((slug) => ({
|
||||
url: `${baseUrl}/tools/${slug}`,
|
||||
lastModified: toolLastModified[slug] ?? new Date('2026-01-01'),
|
||||
changeFrequency:
|
||||
slug === 'barcode-generator' ? ('weekly' as const) : ('monthly' as const),
|
||||
priority: highPriorityTools[slug] ?? 0.8,
|
||||
}));
|
||||
|
||||
// Learn hub and pillar pages
|
||||
const learnPages = [
|
||||
{
|
||||
url: `${baseUrl}/learn`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.9,
|
||||
},
|
||||
...pillarMeta.map((pillar) => ({
|
||||
url: `${baseUrl}/learn/${pillar.key}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
})),
|
||||
];
|
||||
|
||||
const industryUrls = industryPages.map((industry) => ({
|
||||
url: `${baseUrl}/qr-code-for/${industry.slug}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.85,
|
||||
}));
|
||||
|
||||
const growthUseCasePages = [
|
||||
{
|
||||
url: `${baseUrl}/use-cases`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/qr-code-for`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.9,
|
||||
},
|
||||
...publishedUseCases.map((useCase) => ({
|
||||
url: `${baseUrl}${useCase.href}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
})),
|
||||
// German pages under /de
|
||||
{
|
||||
url: `${baseUrl}/de/preise`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
},
|
||||
...Object.values(useCasePagesDe).map((useCase) => ({
|
||||
url: `${baseUrl}${useCase.href}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.8,
|
||||
})),
|
||||
{
|
||||
url: `${baseUrl}/qr-code-for-marketing-campaigns`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.85,
|
||||
},
|
||||
];
|
||||
|
||||
const publishedPseoPages = [
|
||||
...publishedComparisonPages.map((page) => ({
|
||||
url: `${baseUrl}${page.canonicalPath}`,
|
||||
lastModified: new Date('2026-06-22'),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: page.intentStage === 'bottom' ? 0.88 : 0.84,
|
||||
})),
|
||||
...publishedGuidePages.map((page) => ({
|
||||
url: `${baseUrl}${page.canonicalPath}`,
|
||||
lastModified: new Date('2026-06-22'),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.82,
|
||||
})),
|
||||
];
|
||||
|
||||
// Author pages
|
||||
const authorPages = authors.map((author) => ({
|
||||
url: `${baseUrl}/authors/${author.slug}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.7,
|
||||
}));
|
||||
|
||||
return [
|
||||
{
|
||||
url: baseUrl,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 1.0,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/newsletter`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.7,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/restaurants`,
|
||||
lastModified: new Date('2026-04-30'),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/qr-code-erstellen`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 1.0,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/qr-code-tracking`,
|
||||
lastModified: new Date('2026-05-10'),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/qr-code-analytics`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/reprint-calculator`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/dynamic-qr-code-generator`,
|
||||
lastModified: new Date('2026-05-10'),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 0.95,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/dynamic-barcode-generator`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/bulk-qr-code-generator`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/custom-qr-code-generator`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 0.9,
|
||||
},
|
||||
|
||||
{
|
||||
url: `${baseUrl}/pricing`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.8,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/tools`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/features`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.8,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/faq`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.7,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/blog`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: 0.8,
|
||||
},
|
||||
|
||||
{
|
||||
url: `${baseUrl}/privacy`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'yearly',
|
||||
priority: 0.4,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/contact`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'yearly',
|
||||
priority: 0.5,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/about`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'yearly',
|
||||
priority: 0.6,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/press`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.7,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/testimonials`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'monthly',
|
||||
priority: 0.7,
|
||||
},
|
||||
|
||||
...toolPages,
|
||||
...blogPages,
|
||||
...learnPages,
|
||||
...growthUseCasePages,
|
||||
...publishedPseoPages,
|
||||
...industryUrls,
|
||||
...authorPages,
|
||||
];
|
||||
}
|
||||
|
||||
9039
src/lib/blog-data.ts
9039
src/lib/blog-data.ts
File diff suppressed because it is too large
Load Diff
@@ -1,59 +1,76 @@
|
||||
import { blogPosts } from "./blog-data";
|
||||
import { authors } from "./author-data";
|
||||
import type { BlogPost, PillarKey, AuthorProfile } from "./types";
|
||||
|
||||
export function getPublishedPosts(): BlogPost[] {
|
||||
const currentDate = new Date();
|
||||
return blogPosts.filter(p => {
|
||||
if (!p.published) return false;
|
||||
const publishDate = p.datePublished ? new Date(p.datePublished) : new Date(p.date);
|
||||
return publishDate <= currentDate;
|
||||
});
|
||||
}
|
||||
|
||||
export function getPostBySlug(slug: string): BlogPost | undefined {
|
||||
return blogPosts.find(p => p.slug === slug);
|
||||
}
|
||||
|
||||
export function getPublishedPostBySlug(slug: string): BlogPost | undefined {
|
||||
const p = getPostBySlug(slug);
|
||||
if (!p?.published) return undefined;
|
||||
|
||||
const currentDate = new Date();
|
||||
const publishDate = p.datePublished ? new Date(p.datePublished) : new Date(p.date);
|
||||
return publishDate <= currentDate ? p : undefined;
|
||||
}
|
||||
|
||||
export function getPostsByPillar(pillar: PillarKey): BlogPost[] {
|
||||
return getPublishedPosts()
|
||||
.filter(p => p.pillar === pillar)
|
||||
.sort((a, b) => (new Date(a.datePublished).getTime() < new Date(b.datePublished).getTime() ? 1 : -1));
|
||||
}
|
||||
|
||||
export function getAuthorBySlug(slug: string): AuthorProfile | undefined {
|
||||
return authors.find(a => a.slug === slug);
|
||||
}
|
||||
|
||||
export function getPostsByAuthor(slug: string): BlogPost[] {
|
||||
return getPublishedPosts()
|
||||
.filter(p => p.authorSlug === slug)
|
||||
.sort((a, b) => (new Date(a.datePublished).getTime() < new Date(b.datePublished).getTime() ? 1 : -1));
|
||||
}
|
||||
|
||||
export function getRelatedPosts(post: BlogPost, limit = 4): BlogPost[] {
|
||||
const published = getPublishedPosts();
|
||||
|
||||
// explicit relatedSlugs first
|
||||
const explicit = (post.relatedSlugs ?? [])
|
||||
.map(s => published.find(p => p.slug === s))
|
||||
.filter((p): p is BlogPost => !!p);
|
||||
|
||||
if (explicit.length >= limit) return explicit.slice(0, limit);
|
||||
|
||||
// fallback: same pillar, not itself, newest
|
||||
const fallback = published
|
||||
.filter(p => p.slug !== post.slug && p.pillar === post.pillar)
|
||||
.slice(0, limit - explicit.length);
|
||||
|
||||
return [...explicit, ...fallback];
|
||||
}
|
||||
import { blogPosts } from "./blog-data";
|
||||
import { authors } from "./author-data";
|
||||
import type { BlogPost, PillarKey, AuthorProfile } from "./types";
|
||||
|
||||
/**
|
||||
* Blog slugs that are 301-redirected in next.config.mjs.
|
||||
* They must not appear in the blog index, the learn pillars, the sitemap
|
||||
* or IndexNow submissions - linking to a redirect source wastes crawl budget
|
||||
* and passes link equity through an unnecessary hop.
|
||||
* Keep this in sync with the redirects() block in next.config.mjs.
|
||||
*/
|
||||
export const REDIRECTED_BLOG_SLUGS = new Set<string>([
|
||||
"qr-code-analytics",
|
||||
"qr-code-restaurant-menu",
|
||||
]);
|
||||
|
||||
export function isRedirectedSlug(slug: string): boolean {
|
||||
return REDIRECTED_BLOG_SLUGS.has(slug);
|
||||
}
|
||||
|
||||
export function getPublishedPosts(): BlogPost[] {
|
||||
const currentDate = new Date();
|
||||
return blogPosts.filter(p => {
|
||||
if (!p.published) return false;
|
||||
if (REDIRECTED_BLOG_SLUGS.has(p.slug)) return false;
|
||||
const publishDate = p.datePublished ? new Date(p.datePublished) : new Date(p.date);
|
||||
return publishDate <= currentDate;
|
||||
});
|
||||
}
|
||||
|
||||
export function getPostBySlug(slug: string): BlogPost | undefined {
|
||||
return blogPosts.find(p => p.slug === slug);
|
||||
}
|
||||
|
||||
export function getPublishedPostBySlug(slug: string): BlogPost | undefined {
|
||||
const p = getPostBySlug(slug);
|
||||
if (!p?.published) return undefined;
|
||||
|
||||
const currentDate = new Date();
|
||||
const publishDate = p.datePublished ? new Date(p.datePublished) : new Date(p.date);
|
||||
return publishDate <= currentDate ? p : undefined;
|
||||
}
|
||||
|
||||
export function getPostsByPillar(pillar: PillarKey): BlogPost[] {
|
||||
return getPublishedPosts()
|
||||
.filter(p => p.pillar === pillar)
|
||||
.sort((a, b) => (new Date(a.datePublished).getTime() < new Date(b.datePublished).getTime() ? 1 : -1));
|
||||
}
|
||||
|
||||
export function getAuthorBySlug(slug: string): AuthorProfile | undefined {
|
||||
return authors.find(a => a.slug === slug);
|
||||
}
|
||||
|
||||
export function getPostsByAuthor(slug: string): BlogPost[] {
|
||||
return getPublishedPosts()
|
||||
.filter(p => p.authorSlug === slug)
|
||||
.sort((a, b) => (new Date(a.datePublished).getTime() < new Date(b.datePublished).getTime() ? 1 : -1));
|
||||
}
|
||||
|
||||
export function getRelatedPosts(post: BlogPost, limit = 4): BlogPost[] {
|
||||
const published = getPublishedPosts();
|
||||
|
||||
// explicit relatedSlugs first
|
||||
const explicit = (post.relatedSlugs ?? [])
|
||||
.map(s => published.find(p => p.slug === s))
|
||||
.filter((p): p is BlogPost => !!p);
|
||||
|
||||
if (explicit.length >= limit) return explicit.slice(0, limit);
|
||||
|
||||
// fallback: same pillar, not itself, newest
|
||||
const fallback = published
|
||||
.filter(p => p.slug !== post.slug && p.pillar === post.pillar)
|
||||
.slice(0, limit - explicit.length);
|
||||
|
||||
return [...explicit, ...fallback];
|
||||
}
|
||||
|
||||
@@ -1,166 +1,169 @@
|
||||
import axios from 'axios';
|
||||
import dotenv from 'dotenv';
|
||||
import { blogPosts } from '../lib/blog-data';
|
||||
import { pillarMeta } from '../lib/pillar-data';
|
||||
import { authors } from '../lib/author-data';
|
||||
import { publishedUseCases } from '../lib/growth-pages';
|
||||
import { useCasePagesDe } from '../lib/growth-pages-de';
|
||||
import { industryPages } from '../lib/industry-pages';
|
||||
import { publishedComparisonPages, publishedGuidePages } from '../lib/pseo-published-pages';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const INDEXNOW_ENDPOINT = 'https://api.indexnow.org/indexnow';
|
||||
const HOST = 'www.qrmaster.net';
|
||||
// You need to generate a key from https://www.bing.com/indexnow and place it in your public folder
|
||||
// Key must be set in .env as INDEXNOW_KEY
|
||||
const KEY = process.env.INDEXNOW_KEY!;
|
||||
const KEY_LOCATION = `https://${HOST}/${KEY}.txt`;
|
||||
|
||||
export async function submitToIndexNow(urls: string[]) {
|
||||
try {
|
||||
const payload = {
|
||||
host: HOST,
|
||||
key: KEY,
|
||||
keyLocation: KEY_LOCATION,
|
||||
urlList: urls,
|
||||
};
|
||||
|
||||
console.log(`Submitting ${urls.length} URLs to IndexNow...`);
|
||||
const response = await axios.post(INDEXNOW_ENDPOINT, payload, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
if (response.status === 200 || response.status === 202) {
|
||||
console.log('✅ Successfully submitted URLs to IndexNow.');
|
||||
} else {
|
||||
console.error(`⚠️ IndexNow submission returned status: ${response.status}`);
|
||||
}
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error)) {
|
||||
console.error('❌ Error submitting to IndexNow:', error.message);
|
||||
console.error('Response data:', error.response?.data);
|
||||
} else {
|
||||
console.error('❌ Unknown error submitting to IndexNow:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Function to gather all indexable URLs
|
||||
export function getAllIndexableUrls(): string[] {
|
||||
const baseUrl = `https://${HOST}`;
|
||||
|
||||
// Free tools
|
||||
const freeTools = [
|
||||
'barcode-generator', // Added as per request
|
||||
'url-qr-code', 'vcard-qr-code', 'text-qr-code', 'email-qr-code', 'sms-qr-code',
|
||||
'wifi-qr-code', 'crypto-qr-code', 'event-qr-code', 'facebook-qr-code',
|
||||
'instagram-qr-code', 'twitter-qr-code', 'youtube-qr-code', 'whatsapp-qr-code',
|
||||
'tiktok-qr-code', 'geolocation-qr-code', 'call-qr-code-generator', 'paypal-qr-code',
|
||||
'zoom-qr-code', 'teams-qr-code', 'google-review-qr-code',
|
||||
].map(slug => `${baseUrl}/tools/${slug}`);
|
||||
|
||||
// Use-case pages (English) and their German twins under /de
|
||||
const useCasePages = [
|
||||
`${baseUrl}/use-cases`,
|
||||
...publishedUseCases.map(uc => `${baseUrl}${uc.href}`),
|
||||
];
|
||||
const germanPages = [
|
||||
`${baseUrl}/de/preise`,
|
||||
...Object.values(useCasePagesDe).map(uc => `${baseUrl}${uc.href}`),
|
||||
];
|
||||
|
||||
// Blog posts
|
||||
const blogPages = blogPosts.map(post => `${baseUrl}/blog/${post.slug}`);
|
||||
|
||||
// Main pages (synced with sitemap.ts)
|
||||
const mainPages = [
|
||||
baseUrl,
|
||||
`${baseUrl}/about`,
|
||||
`${baseUrl}/contact`,
|
||||
`${baseUrl}/press`,
|
||||
`${baseUrl}/testimonials`,
|
||||
`${baseUrl}/qr-code-erstellen`,
|
||||
`${baseUrl}/qr-code-tracking`,
|
||||
`${baseUrl}/reprint-calculator`,
|
||||
`${baseUrl}/dynamic-qr-code-generator`,
|
||||
`${baseUrl}/dynamic-barcode-generator`,
|
||||
`${baseUrl}/bulk-qr-code-generator`,
|
||||
`${baseUrl}/custom-qr-code-generator`,
|
||||
`${baseUrl}/manage-qr-codes`,
|
||||
`${baseUrl}/pricing`,
|
||||
`${baseUrl}/tools`,
|
||||
`${baseUrl}/features`,
|
||||
`${baseUrl}/faq`,
|
||||
`${baseUrl}/blog`,
|
||||
`${baseUrl}/privacy`,
|
||||
`${baseUrl}/newsletter`,
|
||||
`${baseUrl}/cookie-policy`,
|
||||
`${baseUrl}/terms`,
|
||||
`${baseUrl}/restaurants`,
|
||||
`${baseUrl}/qr-code-analytics`,
|
||||
`${baseUrl}/qr-code-print-size-guide`,
|
||||
];
|
||||
|
||||
// Alternatives & comparison hub pages
|
||||
const alternativesPages = [
|
||||
`${baseUrl}/alternatives`,
|
||||
`${baseUrl}/alternatives/beaconstac`,
|
||||
`${baseUrl}/alternatives/bitly`,
|
||||
`${baseUrl}/alternatives/flowcode`,
|
||||
`${baseUrl}/alternatives/qr-code-generator`,
|
||||
`${baseUrl}/vs`,
|
||||
`${baseUrl}/vs/beaconstac`,
|
||||
];
|
||||
|
||||
// pSEO comparison & guide pages (published subset)
|
||||
const pseoPages = [
|
||||
...publishedComparisonPages.map(page => `${baseUrl}${page.canonicalPath}`),
|
||||
...publishedGuidePages.map(page => `${baseUrl}${page.canonicalPath}`),
|
||||
];
|
||||
|
||||
// Learn hub pillars (the /guide/* URLs these replaced are 301'd in next.config.mjs
|
||||
// and must never be submitted to IndexNow - see redirects() there)
|
||||
const guidePages = [
|
||||
`${baseUrl}/learn/developer`,
|
||||
`${baseUrl}/learn/basics`,
|
||||
`${baseUrl}/learn/tracking`,
|
||||
];
|
||||
|
||||
// Industry landing pages
|
||||
const industryHubPages = [
|
||||
`${baseUrl}/qr-code-for`,
|
||||
...industryPages.map(industry => `${baseUrl}/qr-code-for/${industry.slug}`),
|
||||
];
|
||||
|
||||
// Learn hub and pillar pages
|
||||
const learnPages = [
|
||||
`${baseUrl}/learn`,
|
||||
...pillarMeta.map(pillar => `${baseUrl}/learn/${pillar.key}`)
|
||||
];
|
||||
|
||||
// Author pages
|
||||
const authorPages = authors.map(author => `${baseUrl}/authors/${author.slug}`);
|
||||
|
||||
return [
|
||||
...mainPages,
|
||||
...freeTools,
|
||||
...useCasePages,
|
||||
...germanPages,
|
||||
...blogPages,
|
||||
...learnPages,
|
||||
...authorPages,
|
||||
...alternativesPages,
|
||||
...pseoPages,
|
||||
...guidePages,
|
||||
...industryHubPages,
|
||||
];
|
||||
}
|
||||
|
||||
// If run directly
|
||||
if (require.main === module) {
|
||||
const urls = getAllIndexableUrls();
|
||||
submitToIndexNow(urls);
|
||||
}
|
||||
import axios from 'axios';
|
||||
import dotenv from 'dotenv';
|
||||
import { blogPosts } from '../lib/blog-data';
|
||||
import { REDIRECTED_BLOG_SLUGS } from './content';
|
||||
import { pillarMeta } from '../lib/pillar-data';
|
||||
import { authors } from '../lib/author-data';
|
||||
import { publishedUseCases } from '../lib/growth-pages';
|
||||
import { useCasePagesDe } from '../lib/growth-pages-de';
|
||||
import { industryPages } from '../lib/industry-pages';
|
||||
import { publishedComparisonPages, publishedGuidePages } from '../lib/pseo-published-pages';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const INDEXNOW_ENDPOINT = 'https://api.indexnow.org/indexnow';
|
||||
const HOST = 'www.qrmaster.net';
|
||||
// You need to generate a key from https://www.bing.com/indexnow and place it in your public folder
|
||||
// Key must be set in .env as INDEXNOW_KEY
|
||||
const KEY = process.env.INDEXNOW_KEY!;
|
||||
const KEY_LOCATION = `https://${HOST}/${KEY}.txt`;
|
||||
|
||||
export async function submitToIndexNow(urls: string[]) {
|
||||
try {
|
||||
const payload = {
|
||||
host: HOST,
|
||||
key: KEY,
|
||||
keyLocation: KEY_LOCATION,
|
||||
urlList: urls,
|
||||
};
|
||||
|
||||
console.log(`Submitting ${urls.length} URLs to IndexNow...`);
|
||||
const response = await axios.post(INDEXNOW_ENDPOINT, payload, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
if (response.status === 200 || response.status === 202) {
|
||||
console.log('✅ Successfully submitted URLs to IndexNow.');
|
||||
} else {
|
||||
console.error(`⚠️ IndexNow submission returned status: ${response.status}`);
|
||||
}
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error)) {
|
||||
console.error('❌ Error submitting to IndexNow:', error.message);
|
||||
console.error('Response data:', error.response?.data);
|
||||
} else {
|
||||
console.error('❌ Unknown error submitting to IndexNow:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Function to gather all indexable URLs
|
||||
export function getAllIndexableUrls(): string[] {
|
||||
const baseUrl = `https://${HOST}`;
|
||||
|
||||
// Free tools
|
||||
const freeTools = [
|
||||
'barcode-generator', // Added as per request
|
||||
'url-qr-code', 'vcard-qr-code', 'text-qr-code', 'email-qr-code', 'sms-qr-code',
|
||||
'wifi-qr-code', 'crypto-qr-code', 'event-qr-code', 'facebook-qr-code',
|
||||
'instagram-qr-code', 'twitter-qr-code', 'youtube-qr-code', 'whatsapp-qr-code',
|
||||
'tiktok-qr-code', 'geolocation-qr-code', 'call-qr-code-generator', 'paypal-qr-code',
|
||||
'zoom-qr-code', 'teams-qr-code', 'google-review-qr-code',
|
||||
].map(slug => `${baseUrl}/tools/${slug}`);
|
||||
|
||||
// Use-case pages (English) and their German twins under /de
|
||||
const useCasePages = [
|
||||
`${baseUrl}/use-cases`,
|
||||
...publishedUseCases.map(uc => `${baseUrl}${uc.href}`),
|
||||
];
|
||||
const germanPages = [
|
||||
`${baseUrl}/de/preise`,
|
||||
...Object.values(useCasePagesDe).map(uc => `${baseUrl}${uc.href}`),
|
||||
];
|
||||
|
||||
// Blog posts
|
||||
const blogPages = blogPosts
|
||||
.filter(post => !REDIRECTED_BLOG_SLUGS.has(post.slug))
|
||||
.map(post => `${baseUrl}/blog/${post.slug}`);
|
||||
|
||||
// Main pages (synced with sitemap.ts)
|
||||
const mainPages = [
|
||||
baseUrl,
|
||||
`${baseUrl}/about`,
|
||||
`${baseUrl}/contact`,
|
||||
`${baseUrl}/press`,
|
||||
`${baseUrl}/testimonials`,
|
||||
`${baseUrl}/qr-code-erstellen`,
|
||||
`${baseUrl}/qr-code-tracking`,
|
||||
`${baseUrl}/reprint-calculator`,
|
||||
`${baseUrl}/dynamic-qr-code-generator`,
|
||||
`${baseUrl}/dynamic-barcode-generator`,
|
||||
`${baseUrl}/bulk-qr-code-generator`,
|
||||
`${baseUrl}/custom-qr-code-generator`,
|
||||
`${baseUrl}/manage-qr-codes`,
|
||||
`${baseUrl}/pricing`,
|
||||
`${baseUrl}/tools`,
|
||||
`${baseUrl}/features`,
|
||||
`${baseUrl}/faq`,
|
||||
`${baseUrl}/blog`,
|
||||
`${baseUrl}/privacy`,
|
||||
`${baseUrl}/newsletter`,
|
||||
`${baseUrl}/cookie-policy`,
|
||||
`${baseUrl}/terms`,
|
||||
`${baseUrl}/restaurants`,
|
||||
`${baseUrl}/qr-code-analytics`,
|
||||
`${baseUrl}/qr-code-print-size-guide`,
|
||||
];
|
||||
|
||||
// Alternatives & comparison hub pages
|
||||
const alternativesPages = [
|
||||
`${baseUrl}/alternatives`,
|
||||
`${baseUrl}/alternatives/beaconstac`,
|
||||
`${baseUrl}/alternatives/bitly`,
|
||||
`${baseUrl}/alternatives/flowcode`,
|
||||
`${baseUrl}/alternatives/qr-code-generator`,
|
||||
`${baseUrl}/vs`,
|
||||
`${baseUrl}/vs/beaconstac`,
|
||||
];
|
||||
|
||||
// pSEO comparison & guide pages (published subset)
|
||||
const pseoPages = [
|
||||
...publishedComparisonPages.map(page => `${baseUrl}${page.canonicalPath}`),
|
||||
...publishedGuidePages.map(page => `${baseUrl}${page.canonicalPath}`),
|
||||
];
|
||||
|
||||
// Learn hub pillars (the /guide/* URLs these replaced are 301'd in next.config.mjs
|
||||
// and must never be submitted to IndexNow - see redirects() there)
|
||||
const guidePages = [
|
||||
`${baseUrl}/learn/developer`,
|
||||
`${baseUrl}/learn/basics`,
|
||||
`${baseUrl}/learn/tracking`,
|
||||
];
|
||||
|
||||
// Industry landing pages
|
||||
const industryHubPages = [
|
||||
`${baseUrl}/qr-code-for`,
|
||||
...industryPages.map(industry => `${baseUrl}/qr-code-for/${industry.slug}`),
|
||||
];
|
||||
|
||||
// Learn hub and pillar pages
|
||||
const learnPages = [
|
||||
`${baseUrl}/learn`,
|
||||
...pillarMeta.map(pillar => `${baseUrl}/learn/${pillar.key}`)
|
||||
];
|
||||
|
||||
// Author pages
|
||||
const authorPages = authors.map(author => `${baseUrl}/authors/${author.slug}`);
|
||||
|
||||
return [
|
||||
...mainPages,
|
||||
...freeTools,
|
||||
...useCasePages,
|
||||
...germanPages,
|
||||
...blogPages,
|
||||
...learnPages,
|
||||
...authorPages,
|
||||
...alternativesPages,
|
||||
...pseoPages,
|
||||
...guidePages,
|
||||
...industryHubPages,
|
||||
];
|
||||
}
|
||||
|
||||
// If run directly
|
||||
if (require.main === module) {
|
||||
const urls = getAllIndexableUrls();
|
||||
submitToIndexNow(urls);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user