@rankcli/agent-runtime 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +40 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +701 -51
- package/dist/index.mjs +685 -51
- package/package.json +1 -1
- package/src/fixer/framework-fixes.ts +743 -0
- package/src/fixer/index.ts +5 -0
- package/src/fixer.ts +21 -54
- package/src/index.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -25650,6 +25650,658 @@ async function runDirectAnalysis(url) {
|
|
|
25650
25650
|
// src/fixer.ts
|
|
25651
25651
|
import { readFileSync as readFileSync6, existsSync as existsSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
25652
25652
|
import { join as join6 } from "path";
|
|
25653
|
+
|
|
25654
|
+
// src/fixer/framework-fixes.ts
|
|
25655
|
+
function generateReactSEOHead(options) {
|
|
25656
|
+
const { siteName, siteUrl, title, description, image } = options;
|
|
25657
|
+
return {
|
|
25658
|
+
file: "src/components/SEOHead.tsx",
|
|
25659
|
+
code: `import { Helmet } from 'react-helmet-async';
|
|
25660
|
+
|
|
25661
|
+
interface SEOHeadProps {
|
|
25662
|
+
title?: string;
|
|
25663
|
+
description?: string;
|
|
25664
|
+
image?: string;
|
|
25665
|
+
url?: string;
|
|
25666
|
+
type?: 'website' | 'article';
|
|
25667
|
+
}
|
|
25668
|
+
|
|
25669
|
+
export function SEOHead({
|
|
25670
|
+
title = '${title || `${siteName} - Your tagline here`}',
|
|
25671
|
+
description = '${description || `${siteName} - A compelling description of your product or service.`}',
|
|
25672
|
+
image = '${image || `${siteUrl}/og-image.png`}',
|
|
25673
|
+
url = typeof window !== 'undefined' ? window.location.href : '${siteUrl}',
|
|
25674
|
+
type = 'website',
|
|
25675
|
+
}: SEOHeadProps) {
|
|
25676
|
+
const fullTitle = title.includes('${siteName}') ? title : \`\${title} | ${siteName}\`;
|
|
25677
|
+
|
|
25678
|
+
return (
|
|
25679
|
+
<Helmet>
|
|
25680
|
+
{/* Primary Meta Tags */}
|
|
25681
|
+
<title>{fullTitle}</title>
|
|
25682
|
+
<meta name="description" content={description} />
|
|
25683
|
+
<link rel="canonical" href={url} />
|
|
25684
|
+
|
|
25685
|
+
{/* Open Graph / Facebook */}
|
|
25686
|
+
<meta property="og:type" content={type} />
|
|
25687
|
+
<meta property="og:url" content={url} />
|
|
25688
|
+
<meta property="og:title" content={fullTitle} />
|
|
25689
|
+
<meta property="og:description" content={description} />
|
|
25690
|
+
<meta property="og:image" content={image} />
|
|
25691
|
+
<meta property="og:site_name" content="${siteName}" />
|
|
25692
|
+
|
|
25693
|
+
{/* Twitter */}
|
|
25694
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
25695
|
+
<meta name="twitter:url" content={url} />
|
|
25696
|
+
<meta name="twitter:title" content={fullTitle} />
|
|
25697
|
+
<meta name="twitter:description" content={description} />
|
|
25698
|
+
<meta name="twitter:image" content={image} />
|
|
25699
|
+
</Helmet>
|
|
25700
|
+
);
|
|
25701
|
+
}`,
|
|
25702
|
+
explanation: "React SEO component using react-helmet-async. Wrap your app in <HelmetProvider> and use <SEOHead /> on each page.",
|
|
25703
|
+
installCommands: ["npm install react-helmet-async"],
|
|
25704
|
+
imports: ["import { HelmetProvider } from 'react-helmet-async';"]
|
|
25705
|
+
};
|
|
25706
|
+
}
|
|
25707
|
+
function generateReactAppWrapper() {
|
|
25708
|
+
return {
|
|
25709
|
+
file: "src/main.tsx",
|
|
25710
|
+
code: `import React from 'react';
|
|
25711
|
+
import ReactDOM from 'react-dom/client';
|
|
25712
|
+
import { HelmetProvider } from 'react-helmet-async';
|
|
25713
|
+
import App from './App';
|
|
25714
|
+
import './index.css';
|
|
25715
|
+
|
|
25716
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
25717
|
+
<React.StrictMode>
|
|
25718
|
+
<HelmetProvider>
|
|
25719
|
+
<App />
|
|
25720
|
+
</HelmetProvider>
|
|
25721
|
+
</React.StrictMode>,
|
|
25722
|
+
);`,
|
|
25723
|
+
explanation: "Updated main.tsx with HelmetProvider wrapper for react-helmet-async."
|
|
25724
|
+
};
|
|
25725
|
+
}
|
|
25726
|
+
function generateNextJsAppRouterMetadata(options) {
|
|
25727
|
+
const { siteName, siteUrl, title, description, image } = options;
|
|
25728
|
+
return {
|
|
25729
|
+
file: "app/layout.tsx",
|
|
25730
|
+
code: `import type { Metadata } from 'next';
|
|
25731
|
+
import { Inter } from 'next/font/google';
|
|
25732
|
+
import './globals.css';
|
|
25733
|
+
|
|
25734
|
+
const inter = Inter({ subsets: ['latin'] });
|
|
25735
|
+
|
|
25736
|
+
export const metadata: Metadata = {
|
|
25737
|
+
metadataBase: new URL('${siteUrl}'),
|
|
25738
|
+
title: {
|
|
25739
|
+
default: '${title || siteName}',
|
|
25740
|
+
template: \`%s | ${siteName}\`,
|
|
25741
|
+
},
|
|
25742
|
+
description: '${description || `${siteName} - A compelling description of your product or service.`}',
|
|
25743
|
+
openGraph: {
|
|
25744
|
+
type: 'website',
|
|
25745
|
+
locale: 'en_US',
|
|
25746
|
+
url: '${siteUrl}',
|
|
25747
|
+
siteName: '${siteName}',
|
|
25748
|
+
title: '${title || siteName}',
|
|
25749
|
+
description: '${description || `${siteName} - A compelling description.`}',
|
|
25750
|
+
images: [
|
|
25751
|
+
{
|
|
25752
|
+
url: '${image || "/og-image.png"}',
|
|
25753
|
+
width: 1200,
|
|
25754
|
+
height: 630,
|
|
25755
|
+
alt: '${siteName}',
|
|
25756
|
+
},
|
|
25757
|
+
],
|
|
25758
|
+
},
|
|
25759
|
+
twitter: {
|
|
25760
|
+
card: 'summary_large_image',
|
|
25761
|
+
title: '${title || siteName}',
|
|
25762
|
+
description: '${description || `${siteName} - A compelling description.`}',
|
|
25763
|
+
images: ['${image || "/og-image.png"}'],
|
|
25764
|
+
},
|
|
25765
|
+
robots: {
|
|
25766
|
+
index: true,
|
|
25767
|
+
follow: true,
|
|
25768
|
+
},
|
|
25769
|
+
};
|
|
25770
|
+
|
|
25771
|
+
export default function RootLayout({
|
|
25772
|
+
children,
|
|
25773
|
+
}: {
|
|
25774
|
+
children: React.ReactNode;
|
|
25775
|
+
}) {
|
|
25776
|
+
return (
|
|
25777
|
+
<html lang="en">
|
|
25778
|
+
<body className={inter.className}>{children}</body>
|
|
25779
|
+
</html>
|
|
25780
|
+
);
|
|
25781
|
+
}`,
|
|
25782
|
+
explanation: "Next.js App Router layout with built-in Metadata API. Each page can override with its own metadata export."
|
|
25783
|
+
};
|
|
25784
|
+
}
|
|
25785
|
+
function generateNextJsPageMetadata(options) {
|
|
25786
|
+
const { siteName, description, pageName } = options;
|
|
25787
|
+
return {
|
|
25788
|
+
file: `app/${pageName}/page.tsx`,
|
|
25789
|
+
code: `import type { Metadata } from 'next';
|
|
25790
|
+
|
|
25791
|
+
export const metadata: Metadata = {
|
|
25792
|
+
title: '${pageName.charAt(0).toUpperCase() + pageName.slice(1)}',
|
|
25793
|
+
description: '${description || `Learn more about ${pageName} on ${siteName}.`}',
|
|
25794
|
+
};
|
|
25795
|
+
|
|
25796
|
+
export default function ${pageName.charAt(0).toUpperCase() + pageName.slice(1)}Page() {
|
|
25797
|
+
return (
|
|
25798
|
+
<main>
|
|
25799
|
+
<h1>${pageName.charAt(0).toUpperCase() + pageName.slice(1)}</h1>
|
|
25800
|
+
{/* Your content here */}
|
|
25801
|
+
</main>
|
|
25802
|
+
);
|
|
25803
|
+
}`,
|
|
25804
|
+
explanation: `Next.js page with metadata export. The title will be "${pageName} | ${siteName}" using the template.`
|
|
25805
|
+
};
|
|
25806
|
+
}
|
|
25807
|
+
function generateNextJsDynamicMetadata() {
|
|
25808
|
+
return {
|
|
25809
|
+
file: "app/[slug]/page.tsx",
|
|
25810
|
+
code: `import type { Metadata } from 'next';
|
|
25811
|
+
|
|
25812
|
+
interface PageProps {
|
|
25813
|
+
params: { slug: string };
|
|
25814
|
+
}
|
|
25815
|
+
|
|
25816
|
+
// Generate metadata dynamically based on the slug
|
|
25817
|
+
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
|
|
25818
|
+
// Fetch data based on slug (replace with your data fetching logic)
|
|
25819
|
+
const data = await fetchPageData(params.slug);
|
|
25820
|
+
|
|
25821
|
+
return {
|
|
25822
|
+
title: data.title,
|
|
25823
|
+
description: data.description,
|
|
25824
|
+
openGraph: {
|
|
25825
|
+
title: data.title,
|
|
25826
|
+
description: data.description,
|
|
25827
|
+
images: data.image ? [{ url: data.image }] : [],
|
|
25828
|
+
},
|
|
25829
|
+
};
|
|
25830
|
+
}
|
|
25831
|
+
|
|
25832
|
+
// Pre-generate static pages for known slugs (improves SEO)
|
|
25833
|
+
export async function generateStaticParams() {
|
|
25834
|
+
const pages = await fetchAllPageSlugs();
|
|
25835
|
+
return pages.map((slug) => ({ slug }));
|
|
25836
|
+
}
|
|
25837
|
+
|
|
25838
|
+
async function fetchPageData(slug: string) {
|
|
25839
|
+
// Replace with your actual data fetching
|
|
25840
|
+
return {
|
|
25841
|
+
title: slug.replace(/-/g, ' ').replace(/\\b\\w/g, c => c.toUpperCase()),
|
|
25842
|
+
description: \`Learn about \${slug}\`,
|
|
25843
|
+
image: null,
|
|
25844
|
+
};
|
|
25845
|
+
}
|
|
25846
|
+
|
|
25847
|
+
async function fetchAllPageSlugs() {
|
|
25848
|
+
// Replace with your actual data source
|
|
25849
|
+
return ['about', 'contact', 'pricing'];
|
|
25850
|
+
}
|
|
25851
|
+
|
|
25852
|
+
export default function DynamicPage({ params }: PageProps) {
|
|
25853
|
+
return (
|
|
25854
|
+
<main>
|
|
25855
|
+
<h1>{params.slug}</h1>
|
|
25856
|
+
</main>
|
|
25857
|
+
);
|
|
25858
|
+
}`,
|
|
25859
|
+
explanation: "Next.js dynamic route with generateMetadata and generateStaticParams for SEO-optimized dynamic pages."
|
|
25860
|
+
};
|
|
25861
|
+
}
|
|
25862
|
+
function generateNextJsRobots(siteUrl) {
|
|
25863
|
+
return {
|
|
25864
|
+
file: "app/robots.ts",
|
|
25865
|
+
code: `import type { MetadataRoute } from 'next';
|
|
25866
|
+
|
|
25867
|
+
export default function robots(): MetadataRoute.Robots {
|
|
25868
|
+
return {
|
|
25869
|
+
rules: [
|
|
25870
|
+
{
|
|
25871
|
+
userAgent: '*',
|
|
25872
|
+
allow: '/',
|
|
25873
|
+
disallow: ['/api/', '/admin/', '/_next/'],
|
|
25874
|
+
},
|
|
25875
|
+
],
|
|
25876
|
+
sitemap: '${siteUrl}/sitemap.xml',
|
|
25877
|
+
};
|
|
25878
|
+
}`,
|
|
25879
|
+
explanation: "Next.js App Router robots.txt generator. Automatically served at /robots.txt."
|
|
25880
|
+
};
|
|
25881
|
+
}
|
|
25882
|
+
function generateNextJsSitemap(siteUrl) {
|
|
25883
|
+
return {
|
|
25884
|
+
file: "app/sitemap.ts",
|
|
25885
|
+
code: `import type { MetadataRoute } from 'next';
|
|
25886
|
+
|
|
25887
|
+
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|
25888
|
+
// Static pages
|
|
25889
|
+
const staticPages: MetadataRoute.Sitemap = [
|
|
25890
|
+
{
|
|
25891
|
+
url: '${siteUrl}',
|
|
25892
|
+
lastModified: new Date(),
|
|
25893
|
+
changeFrequency: 'daily',
|
|
25894
|
+
priority: 1,
|
|
25895
|
+
},
|
|
25896
|
+
{
|
|
25897
|
+
url: '${siteUrl}/about',
|
|
25898
|
+
lastModified: new Date(),
|
|
25899
|
+
changeFrequency: 'monthly',
|
|
25900
|
+
priority: 0.8,
|
|
25901
|
+
},
|
|
25902
|
+
{
|
|
25903
|
+
url: '${siteUrl}/pricing',
|
|
25904
|
+
lastModified: new Date(),
|
|
25905
|
+
changeFrequency: 'weekly',
|
|
25906
|
+
priority: 0.9,
|
|
25907
|
+
},
|
|
25908
|
+
];
|
|
25909
|
+
|
|
25910
|
+
// Dynamic pages (fetch from your database/CMS)
|
|
25911
|
+
// const posts = await fetchAllPosts();
|
|
25912
|
+
// const dynamicPages = posts.map((post) => ({
|
|
25913
|
+
// url: \`${siteUrl}/blog/\${post.slug}\`,
|
|
25914
|
+
// lastModified: post.updatedAt,
|
|
25915
|
+
// changeFrequency: 'weekly' as const,
|
|
25916
|
+
// priority: 0.7,
|
|
25917
|
+
// }));
|
|
25918
|
+
|
|
25919
|
+
return [...staticPages];
|
|
25920
|
+
}`,
|
|
25921
|
+
explanation: "Next.js App Router sitemap generator. Automatically served at /sitemap.xml."
|
|
25922
|
+
};
|
|
25923
|
+
}
|
|
25924
|
+
function generateNextJsPagesRouterHead(options) {
|
|
25925
|
+
const { siteName, siteUrl, title, description, image } = options;
|
|
25926
|
+
return {
|
|
25927
|
+
file: "components/SEOHead.tsx",
|
|
25928
|
+
code: `import Head from 'next/head';
|
|
25929
|
+
|
|
25930
|
+
interface SEOHeadProps {
|
|
25931
|
+
title?: string;
|
|
25932
|
+
description?: string;
|
|
25933
|
+
image?: string;
|
|
25934
|
+
url?: string;
|
|
25935
|
+
type?: 'website' | 'article';
|
|
25936
|
+
}
|
|
25937
|
+
|
|
25938
|
+
export function SEOHead({
|
|
25939
|
+
title = '${title || siteName}',
|
|
25940
|
+
description = '${description || `${siteName} - A compelling description.`}',
|
|
25941
|
+
image = '${image || `${siteUrl}/og-image.png`}',
|
|
25942
|
+
url = '${siteUrl}',
|
|
25943
|
+
type = 'website',
|
|
25944
|
+
}: SEOHeadProps) {
|
|
25945
|
+
const fullTitle = title.includes('${siteName}') ? title : \`\${title} | ${siteName}\`;
|
|
25946
|
+
|
|
25947
|
+
return (
|
|
25948
|
+
<Head>
|
|
25949
|
+
<title>{fullTitle}</title>
|
|
25950
|
+
<meta name="description" content={description} />
|
|
25951
|
+
<link rel="canonical" href={url} />
|
|
25952
|
+
|
|
25953
|
+
<meta property="og:type" content={type} />
|
|
25954
|
+
<meta property="og:url" content={url} />
|
|
25955
|
+
<meta property="og:title" content={fullTitle} />
|
|
25956
|
+
<meta property="og:description" content={description} />
|
|
25957
|
+
<meta property="og:image" content={image} />
|
|
25958
|
+
<meta property="og:site_name" content="${siteName}" />
|
|
25959
|
+
|
|
25960
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
25961
|
+
<meta name="twitter:title" content={fullTitle} />
|
|
25962
|
+
<meta name="twitter:description" content={description} />
|
|
25963
|
+
<meta name="twitter:image" content={image} />
|
|
25964
|
+
</Head>
|
|
25965
|
+
);
|
|
25966
|
+
}`,
|
|
25967
|
+
explanation: "Next.js Pages Router SEO component using next/head. Import and use on each page."
|
|
25968
|
+
};
|
|
25969
|
+
}
|
|
25970
|
+
function generateNuxtSEOHead(options) {
|
|
25971
|
+
const { siteName, siteUrl, title, description, image } = options;
|
|
25972
|
+
return {
|
|
25973
|
+
file: "composables/useSEO.ts",
|
|
25974
|
+
code: `export function useSEO(options: {
|
|
25975
|
+
title?: string;
|
|
25976
|
+
description?: string;
|
|
25977
|
+
image?: string;
|
|
25978
|
+
url?: string;
|
|
25979
|
+
type?: 'website' | 'article';
|
|
25980
|
+
} = {}) {
|
|
25981
|
+
const route = useRoute();
|
|
25982
|
+
const config = useRuntimeConfig();
|
|
25983
|
+
|
|
25984
|
+
const defaults = {
|
|
25985
|
+
title: '${title || siteName}',
|
|
25986
|
+
description: '${description || `${siteName} - A compelling description.`}',
|
|
25987
|
+
image: '${image || `${siteUrl}/og-image.png`}',
|
|
25988
|
+
url: \`${siteUrl}\${route.path}\`,
|
|
25989
|
+
type: 'website' as const,
|
|
25990
|
+
};
|
|
25991
|
+
|
|
25992
|
+
const meta = { ...defaults, ...options };
|
|
25993
|
+
const fullTitle = meta.title.includes('${siteName}')
|
|
25994
|
+
? meta.title
|
|
25995
|
+
: \`\${meta.title} | ${siteName}\`;
|
|
25996
|
+
|
|
25997
|
+
useHead({
|
|
25998
|
+
title: fullTitle,
|
|
25999
|
+
meta: [
|
|
26000
|
+
{ name: 'description', content: meta.description },
|
|
26001
|
+
// Open Graph
|
|
26002
|
+
{ property: 'og:type', content: meta.type },
|
|
26003
|
+
{ property: 'og:url', content: meta.url },
|
|
26004
|
+
{ property: 'og:title', content: fullTitle },
|
|
26005
|
+
{ property: 'og:description', content: meta.description },
|
|
26006
|
+
{ property: 'og:image', content: meta.image },
|
|
26007
|
+
{ property: 'og:site_name', content: '${siteName}' },
|
|
26008
|
+
// Twitter
|
|
26009
|
+
{ name: 'twitter:card', content: 'summary_large_image' },
|
|
26010
|
+
{ name: 'twitter:title', content: fullTitle },
|
|
26011
|
+
{ name: 'twitter:description', content: meta.description },
|
|
26012
|
+
{ name: 'twitter:image', content: meta.image },
|
|
26013
|
+
],
|
|
26014
|
+
link: [
|
|
26015
|
+
{ rel: 'canonical', href: meta.url },
|
|
26016
|
+
],
|
|
26017
|
+
});
|
|
26018
|
+
}`,
|
|
26019
|
+
explanation: "Nuxt 3 SEO composable using useHead(). Call useSEO() in any page to set meta tags."
|
|
26020
|
+
};
|
|
26021
|
+
}
|
|
26022
|
+
function generateNuxtPageExample() {
|
|
26023
|
+
return {
|
|
26024
|
+
file: "pages/about.vue",
|
|
26025
|
+
code: `<script setup lang="ts">
|
|
26026
|
+
useSEO({
|
|
26027
|
+
title: 'About Us',
|
|
26028
|
+
description: 'Learn more about our company and mission.',
|
|
26029
|
+
});
|
|
26030
|
+
</script>
|
|
26031
|
+
|
|
26032
|
+
<template>
|
|
26033
|
+
<main>
|
|
26034
|
+
<h1>About Us</h1>
|
|
26035
|
+
<!-- Your content here -->
|
|
26036
|
+
</main>
|
|
26037
|
+
</template>`,
|
|
26038
|
+
explanation: "Example Nuxt page using the useSEO composable."
|
|
26039
|
+
};
|
|
26040
|
+
}
|
|
26041
|
+
function generateVueSEOHead(options) {
|
|
26042
|
+
const { siteName, siteUrl, title, description, image } = options;
|
|
26043
|
+
return {
|
|
26044
|
+
file: "src/composables/useSEO.ts",
|
|
26045
|
+
code: `import { useHead } from '@unhead/vue';
|
|
26046
|
+
import { computed, ref } from 'vue';
|
|
26047
|
+
|
|
26048
|
+
interface SEOOptions {
|
|
26049
|
+
title?: string;
|
|
26050
|
+
description?: string;
|
|
26051
|
+
image?: string;
|
|
26052
|
+
url?: string;
|
|
26053
|
+
type?: 'website' | 'article';
|
|
26054
|
+
}
|
|
26055
|
+
|
|
26056
|
+
export function useSEO(options: SEOOptions = {}) {
|
|
26057
|
+
const defaults = {
|
|
26058
|
+
title: '${title || siteName}',
|
|
26059
|
+
description: '${description || `${siteName} - A compelling description.`}',
|
|
26060
|
+
image: '${image || `${siteUrl}/og-image.png`}',
|
|
26061
|
+
url: typeof window !== 'undefined' ? window.location.href : '${siteUrl}',
|
|
26062
|
+
type: 'website' as const,
|
|
26063
|
+
};
|
|
26064
|
+
|
|
26065
|
+
const meta = { ...defaults, ...options };
|
|
26066
|
+
const fullTitle = computed(() =>
|
|
26067
|
+
meta.title.includes('${siteName}') ? meta.title : \`\${meta.title} | ${siteName}\`
|
|
26068
|
+
);
|
|
26069
|
+
|
|
26070
|
+
useHead({
|
|
26071
|
+
title: fullTitle,
|
|
26072
|
+
meta: [
|
|
26073
|
+
{ name: 'description', content: meta.description },
|
|
26074
|
+
{ property: 'og:type', content: meta.type },
|
|
26075
|
+
{ property: 'og:url', content: meta.url },
|
|
26076
|
+
{ property: 'og:title', content: fullTitle.value },
|
|
26077
|
+
{ property: 'og:description', content: meta.description },
|
|
26078
|
+
{ property: 'og:image', content: meta.image },
|
|
26079
|
+
{ property: 'og:site_name', content: '${siteName}' },
|
|
26080
|
+
{ name: 'twitter:card', content: 'summary_large_image' },
|
|
26081
|
+
{ name: 'twitter:title', content: fullTitle.value },
|
|
26082
|
+
{ name: 'twitter:description', content: meta.description },
|
|
26083
|
+
{ name: 'twitter:image', content: meta.image },
|
|
26084
|
+
],
|
|
26085
|
+
link: [
|
|
26086
|
+
{ rel: 'canonical', href: meta.url },
|
|
26087
|
+
],
|
|
26088
|
+
});
|
|
26089
|
+
}`,
|
|
26090
|
+
explanation: "Vue 3 SEO composable using @unhead/vue. Install with: npm install @unhead/vue",
|
|
26091
|
+
installCommands: ["npm install @unhead/vue"]
|
|
26092
|
+
};
|
|
26093
|
+
}
|
|
26094
|
+
function generateAstroBaseHead(options) {
|
|
26095
|
+
const { siteName, siteUrl, title, description, image } = options;
|
|
26096
|
+
return {
|
|
26097
|
+
file: "src/components/BaseHead.astro",
|
|
26098
|
+
code: `---
|
|
26099
|
+
interface Props {
|
|
26100
|
+
title?: string;
|
|
26101
|
+
description?: string;
|
|
26102
|
+
image?: string;
|
|
26103
|
+
type?: 'website' | 'article';
|
|
26104
|
+
}
|
|
26105
|
+
|
|
26106
|
+
const {
|
|
26107
|
+
title = '${title || siteName}',
|
|
26108
|
+
description = '${description || `${siteName} - A compelling description.`}',
|
|
26109
|
+
image = '${image || "/og-image.png"}',
|
|
26110
|
+
type = 'website',
|
|
26111
|
+
} = Astro.props;
|
|
26112
|
+
|
|
26113
|
+
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
|
|
26114
|
+
const fullTitle = title.includes('${siteName}') ? title : \`\${title} | ${siteName}\`;
|
|
26115
|
+
const imageURL = new URL(image, Astro.site);
|
|
26116
|
+
---
|
|
26117
|
+
|
|
26118
|
+
<!-- Global Metadata -->
|
|
26119
|
+
<meta charset="utf-8" />
|
|
26120
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
26121
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
26122
|
+
<meta name="generator" content={Astro.generator} />
|
|
26123
|
+
|
|
26124
|
+
<!-- Canonical URL -->
|
|
26125
|
+
<link rel="canonical" href={canonicalURL} />
|
|
26126
|
+
|
|
26127
|
+
<!-- Primary Meta Tags -->
|
|
26128
|
+
<title>{fullTitle}</title>
|
|
26129
|
+
<meta name="title" content={fullTitle} />
|
|
26130
|
+
<meta name="description" content={description} />
|
|
26131
|
+
|
|
26132
|
+
<!-- Open Graph / Facebook -->
|
|
26133
|
+
<meta property="og:type" content={type} />
|
|
26134
|
+
<meta property="og:url" content={canonicalURL} />
|
|
26135
|
+
<meta property="og:title" content={fullTitle} />
|
|
26136
|
+
<meta property="og:description" content={description} />
|
|
26137
|
+
<meta property="og:image" content={imageURL} />
|
|
26138
|
+
<meta property="og:site_name" content="${siteName}" />
|
|
26139
|
+
|
|
26140
|
+
<!-- Twitter -->
|
|
26141
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
26142
|
+
<meta name="twitter:url" content={canonicalURL} />
|
|
26143
|
+
<meta name="twitter:title" content={fullTitle} />
|
|
26144
|
+
<meta name="twitter:description" content={description} />
|
|
26145
|
+
<meta name="twitter:image" content={imageURL} />`,
|
|
26146
|
+
explanation: 'Astro BaseHead component. Import in your layout: <BaseHead title="Page Title" description="..." />'
|
|
26147
|
+
};
|
|
26148
|
+
}
|
|
26149
|
+
function generateAstroLayout(siteName) {
|
|
26150
|
+
return {
|
|
26151
|
+
file: "src/layouts/BaseLayout.astro",
|
|
26152
|
+
code: `---
|
|
26153
|
+
import BaseHead from '../components/BaseHead.astro';
|
|
26154
|
+
|
|
26155
|
+
interface Props {
|
|
26156
|
+
title?: string;
|
|
26157
|
+
description?: string;
|
|
26158
|
+
image?: string;
|
|
26159
|
+
}
|
|
26160
|
+
|
|
26161
|
+
const { title, description, image } = Astro.props;
|
|
26162
|
+
---
|
|
26163
|
+
|
|
26164
|
+
<!DOCTYPE html>
|
|
26165
|
+
<html lang="en">
|
|
26166
|
+
<head>
|
|
26167
|
+
<BaseHead title={title} description={description} image={image} />
|
|
26168
|
+
</head>
|
|
26169
|
+
<body>
|
|
26170
|
+
<main>
|
|
26171
|
+
<slot />
|
|
26172
|
+
</main>
|
|
26173
|
+
</body>
|
|
26174
|
+
</html>`,
|
|
26175
|
+
explanation: "Astro layout using BaseHead component. Use in pages with frontmatter."
|
|
26176
|
+
};
|
|
26177
|
+
}
|
|
26178
|
+
function generateSvelteKitSEOHead(options) {
|
|
26179
|
+
const { siteName, siteUrl, title, description, image } = options;
|
|
26180
|
+
return {
|
|
26181
|
+
file: "src/lib/components/SEOHead.svelte",
|
|
26182
|
+
code: `<script lang="ts">
|
|
26183
|
+
import { page } from '$app/stores';
|
|
26184
|
+
|
|
26185
|
+
export let title = '${title || siteName}';
|
|
26186
|
+
export let description = '${description || `${siteName} - A compelling description.`}';
|
|
26187
|
+
export let image = '${image || `${siteUrl}/og-image.png`}';
|
|
26188
|
+
export let type: 'website' | 'article' = 'website';
|
|
26189
|
+
|
|
26190
|
+
$: fullTitle = title.includes('${siteName}') ? title : \`\${title} | ${siteName}\`;
|
|
26191
|
+
$: canonicalUrl = $page.url.href;
|
|
26192
|
+
</script>
|
|
26193
|
+
|
|
26194
|
+
<svelte:head>
|
|
26195
|
+
<title>{fullTitle}</title>
|
|
26196
|
+
<meta name="description" content={description} />
|
|
26197
|
+
<link rel="canonical" href={canonicalUrl} />
|
|
26198
|
+
|
|
26199
|
+
<meta property="og:type" content={type} />
|
|
26200
|
+
<meta property="og:url" content={canonicalUrl} />
|
|
26201
|
+
<meta property="og:title" content={fullTitle} />
|
|
26202
|
+
<meta property="og:description" content={description} />
|
|
26203
|
+
<meta property="og:image" content={image} />
|
|
26204
|
+
<meta property="og:site_name" content="${siteName}" />
|
|
26205
|
+
|
|
26206
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
26207
|
+
<meta name="twitter:title" content={fullTitle} />
|
|
26208
|
+
<meta name="twitter:description" content={description} />
|
|
26209
|
+
<meta name="twitter:image" content={image} />
|
|
26210
|
+
</svelte:head>`,
|
|
26211
|
+
explanation: "SvelteKit SEO component using svelte:head. Import and use in +page.svelte files."
|
|
26212
|
+
};
|
|
26213
|
+
}
|
|
26214
|
+
function generateAngularSEOService(options) {
|
|
26215
|
+
const { siteName, siteUrl, title, description, image } = options;
|
|
26216
|
+
return {
|
|
26217
|
+
file: "src/app/services/seo.service.ts",
|
|
26218
|
+
code: `import { Injectable } from '@angular/core';
|
|
26219
|
+
import { Meta, Title } from '@angular/platform-browser';
|
|
26220
|
+
import { Router } from '@angular/router';
|
|
26221
|
+
|
|
26222
|
+
interface SEOConfig {
|
|
26223
|
+
title?: string;
|
|
26224
|
+
description?: string;
|
|
26225
|
+
image?: string;
|
|
26226
|
+
type?: 'website' | 'article';
|
|
26227
|
+
}
|
|
26228
|
+
|
|
26229
|
+
@Injectable({
|
|
26230
|
+
providedIn: 'root'
|
|
26231
|
+
})
|
|
26232
|
+
export class SEOService {
|
|
26233
|
+
private siteName = '${siteName}';
|
|
26234
|
+
private siteUrl = '${siteUrl}';
|
|
26235
|
+
private defaultDescription = '${description || `${siteName} - A compelling description.`}';
|
|
26236
|
+
private defaultImage = '${image || `${siteUrl}/og-image.png`}';
|
|
26237
|
+
|
|
26238
|
+
constructor(
|
|
26239
|
+
private meta: Meta,
|
|
26240
|
+
private titleService: Title,
|
|
26241
|
+
private router: Router
|
|
26242
|
+
) {}
|
|
26243
|
+
|
|
26244
|
+
updateMeta(config: SEOConfig = {}): void {
|
|
26245
|
+
const title = config.title || this.siteName;
|
|
26246
|
+
const fullTitle = title.includes(this.siteName) ? title : \`\${title} | \${this.siteName}\`;
|
|
26247
|
+
const description = config.description || this.defaultDescription;
|
|
26248
|
+
const image = config.image || this.defaultImage;
|
|
26249
|
+
const url = this.siteUrl + this.router.url;
|
|
26250
|
+
const type = config.type || 'website';
|
|
26251
|
+
|
|
26252
|
+
// Title
|
|
26253
|
+
this.titleService.setTitle(fullTitle);
|
|
26254
|
+
|
|
26255
|
+
// Primary Meta
|
|
26256
|
+
this.meta.updateTag({ name: 'description', content: description });
|
|
26257
|
+
this.meta.updateTag({ rel: 'canonical', href: url });
|
|
26258
|
+
|
|
26259
|
+
// Open Graph
|
|
26260
|
+
this.meta.updateTag({ property: 'og:type', content: type });
|
|
26261
|
+
this.meta.updateTag({ property: 'og:url', content: url });
|
|
26262
|
+
this.meta.updateTag({ property: 'og:title', content: fullTitle });
|
|
26263
|
+
this.meta.updateTag({ property: 'og:description', content: description });
|
|
26264
|
+
this.meta.updateTag({ property: 'og:image', content: image });
|
|
26265
|
+
this.meta.updateTag({ property: 'og:site_name', content: this.siteName });
|
|
26266
|
+
|
|
26267
|
+
// Twitter
|
|
26268
|
+
this.meta.updateTag({ name: 'twitter:card', content: 'summary_large_image' });
|
|
26269
|
+
this.meta.updateTag({ name: 'twitter:title', content: fullTitle });
|
|
26270
|
+
this.meta.updateTag({ name: 'twitter:description', content: description });
|
|
26271
|
+
this.meta.updateTag({ name: 'twitter:image', content: image });
|
|
26272
|
+
}
|
|
26273
|
+
}`,
|
|
26274
|
+
explanation: "Angular SEO service using Meta and Title services. Inject and call updateMeta() in components."
|
|
26275
|
+
};
|
|
26276
|
+
}
|
|
26277
|
+
function getFrameworkSpecificFix(framework, options) {
|
|
26278
|
+
const name = framework.name.toLowerCase();
|
|
26279
|
+
if (name.includes("next")) {
|
|
26280
|
+
if (framework.router === "app") {
|
|
26281
|
+
return generateNextJsAppRouterMetadata(options);
|
|
26282
|
+
} else {
|
|
26283
|
+
return generateNextJsPagesRouterHead(options);
|
|
26284
|
+
}
|
|
26285
|
+
}
|
|
26286
|
+
if (name.includes("nuxt")) {
|
|
26287
|
+
return generateNuxtSEOHead(options);
|
|
26288
|
+
}
|
|
26289
|
+
if (name.includes("vue")) {
|
|
26290
|
+
return generateVueSEOHead(options);
|
|
26291
|
+
}
|
|
26292
|
+
if (name.includes("astro")) {
|
|
26293
|
+
return generateAstroBaseHead(options);
|
|
26294
|
+
}
|
|
26295
|
+
if (name.includes("svelte")) {
|
|
26296
|
+
return generateSvelteKitSEOHead(options);
|
|
26297
|
+
}
|
|
26298
|
+
if (name.includes("angular")) {
|
|
26299
|
+
return generateAngularSEOService(options);
|
|
26300
|
+
}
|
|
26301
|
+
return generateReactSEOHead(options);
|
|
26302
|
+
}
|
|
26303
|
+
|
|
26304
|
+
// src/fixer.ts
|
|
25653
26305
|
async function generateFixes(issues, options) {
|
|
25654
26306
|
const { cwd, url } = options;
|
|
25655
26307
|
let framework = options.framework;
|
|
@@ -26019,60 +26671,26 @@ function generateSitemapFix(context, url) {
|
|
|
26019
26671
|
};
|
|
26020
26672
|
}
|
|
26021
26673
|
function generateSPAMetaFix(context, framework) {
|
|
26022
|
-
const {
|
|
26023
|
-
const
|
|
26024
|
-
|
|
26025
|
-
|
|
26026
|
-
|
|
26027
|
-
|
|
26028
|
-
|
|
26029
|
-
|
|
26030
|
-
|
|
26031
|
-
|
|
26032
|
-
|
|
26033
|
-
|
|
26034
|
-
image?: string;
|
|
26035
|
-
url?: string;
|
|
26036
|
-
}
|
|
26674
|
+
const { url } = context;
|
|
26675
|
+
const fullUrl = url || "https://example.com";
|
|
26676
|
+
const siteName = new URL(fullUrl).hostname.replace("www.", "").split(".")[0];
|
|
26677
|
+
const capitalizedName = siteName.charAt(0).toUpperCase() + siteName.slice(1);
|
|
26678
|
+
const generatedCode = getFrameworkSpecificFix(framework, {
|
|
26679
|
+
siteName: capitalizedName,
|
|
26680
|
+
siteUrl: fullUrl,
|
|
26681
|
+
title: `${capitalizedName} - Your tagline here`,
|
|
26682
|
+
description: `${capitalizedName} - A compelling description of your product or service.`,
|
|
26683
|
+
image: `${fullUrl}/og-image.png`
|
|
26684
|
+
});
|
|
26685
|
+
const installInstructions = generatedCode.installCommands ? `
|
|
26037
26686
|
|
|
26038
|
-
|
|
26039
|
-
title = 'Your Site Name',
|
|
26040
|
-
description = 'Your site description',
|
|
26041
|
-
image = '/og-image.png',
|
|
26042
|
-
url = window.location.href,
|
|
26043
|
-
}: SEOHeadProps) {
|
|
26044
|
-
return (
|
|
26045
|
-
<Helmet>
|
|
26046
|
-
<title>{title}</title>
|
|
26047
|
-
<meta name="description" content={description} />
|
|
26048
|
-
<link rel="canonical" href={url} />
|
|
26049
|
-
|
|
26050
|
-
{/* Open Graph */}
|
|
26051
|
-
<meta property="og:title" content={title} />
|
|
26052
|
-
<meta property="og:description" content={description} />
|
|
26053
|
-
<meta property="og:image" content={image} />
|
|
26054
|
-
<meta property="og:url" content={url} />
|
|
26055
|
-
<meta property="og:type" content="website" />
|
|
26056
|
-
|
|
26057
|
-
{/* Twitter */}
|
|
26058
|
-
<meta name="twitter:card" content="summary_large_image" />
|
|
26059
|
-
<meta name="twitter:title" content={title} />
|
|
26060
|
-
<meta name="twitter:description" content={description} />
|
|
26061
|
-
<meta name="twitter:image" content={image} />
|
|
26062
|
-
</Helmet>
|
|
26063
|
-
);
|
|
26064
|
-
}`,
|
|
26065
|
-
explanation: "Created SEOHead component using react-helmet-async for dynamic meta tags. Install: npm install react-helmet-async"
|
|
26066
|
-
};
|
|
26067
|
-
}
|
|
26687
|
+
Install: ${generatedCode.installCommands.join(" && ")}` : "";
|
|
26068
26688
|
return {
|
|
26069
|
-
issue: { code: "SPA_NO_META_MANAGEMENT", message: "SPA without meta management", severity: "warning" },
|
|
26070
|
-
file:
|
|
26689
|
+
issue: { code: "SPA_NO_META_MANAGEMENT", message: "SPA without dynamic meta tag management", severity: "warning" },
|
|
26690
|
+
file: generatedCode.file,
|
|
26071
26691
|
before: null,
|
|
26072
|
-
after:
|
|
26073
|
-
explanation:
|
|
26074
|
-
skipped: true,
|
|
26075
|
-
skipReason: `Framework-specific solution needed for ${framework.name}`
|
|
26692
|
+
after: generatedCode.code,
|
|
26693
|
+
explanation: generatedCode.explanation + installInstructions
|
|
26076
26694
|
};
|
|
26077
26695
|
}
|
|
26078
26696
|
function generatePreconnectFix(context) {
|
|
@@ -28914,6 +29532,9 @@ export {
|
|
|
28914
29532
|
frameworks_exports as frameworks,
|
|
28915
29533
|
generateAICitableContent,
|
|
28916
29534
|
generateAllFixes,
|
|
29535
|
+
generateAngularSEOService,
|
|
29536
|
+
generateAstroBaseHead,
|
|
29537
|
+
generateAstroLayout,
|
|
28917
29538
|
generateAstroMeta,
|
|
28918
29539
|
generateBlogPost,
|
|
28919
29540
|
generateBranchName,
|
|
@@ -28938,22 +29559,35 @@ export {
|
|
|
28938
29559
|
generateKeyFacts,
|
|
28939
29560
|
generateMarkdownReport,
|
|
28940
29561
|
generateNextAppMetadata,
|
|
29562
|
+
generateNextJsAppRouterMetadata,
|
|
29563
|
+
generateNextJsDynamicMetadata,
|
|
29564
|
+
generateNextJsPageMetadata,
|
|
29565
|
+
generateNextJsPagesRouterHead,
|
|
29566
|
+
generateNextJsRobots,
|
|
29567
|
+
generateNextJsSitemap,
|
|
28941
29568
|
generateNextPagesHead,
|
|
29569
|
+
generateNuxtPageExample,
|
|
29570
|
+
generateNuxtSEOHead,
|
|
28942
29571
|
generatePDFReport,
|
|
28943
29572
|
generatePRDescription,
|
|
29573
|
+
generateReactAppWrapper,
|
|
28944
29574
|
generateReactHelmetSocialMeta,
|
|
29575
|
+
generateReactSEOHead,
|
|
28945
29576
|
generateRecommendationQueries,
|
|
28946
29577
|
generateRemixMeta,
|
|
28947
29578
|
generateSecretsDoc,
|
|
28948
29579
|
generateSocialMetaFix,
|
|
28949
29580
|
generateSvelteKitMeta,
|
|
29581
|
+
generateSvelteKitSEOHead,
|
|
28950
29582
|
generateUncertaintyQuestions,
|
|
29583
|
+
generateVueSEOHead,
|
|
28951
29584
|
generateWizardQuestions,
|
|
28952
29585
|
generateWorkflow,
|
|
28953
29586
|
getAIVisibilitySummary,
|
|
28954
29587
|
getAutocompleteSuggestions,
|
|
28955
29588
|
getDateRange,
|
|
28956
29589
|
getExpandedSuggestions,
|
|
29590
|
+
getFrameworkSpecificFix,
|
|
28957
29591
|
getGSCSetupInstructions,
|
|
28958
29592
|
getGitUser,
|
|
28959
29593
|
getKeywordData,
|