Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

fix(seo): fix schema.org and Open Graph validation errors (#282)

Vlad Sazonauba85869a4f59
diff --git a/src/app/(main)/(app)/home-json-ld.tsx b/src/app/(main)/(app)/home-json-ld.tsx
index 758f1a1..b44d04b 100644
--- a/src/app/(main)/(app)/home-json-ld.tsx
+++ b/src/app/(main)/(app)/home-json-ld.tsx
@@ -6,7 +6,6 @@ import { JsonLdScript } from "@/lib/seo/render-json-ld";
import {
buildFullWebSite,
buildOrganization,
- buildSiteNavigationList,
buildWebApplication,
HOME_PAGE_DESCRIPTION,
HOME_PAGE_TITLE,
@@ -44,7 +43,6 @@ export function buildHomeJsonLdGraph(
buildFullWebSite(),
buildOrganization(),
buildWebApplication(),
- buildSiteNavigationList(),
{
"@type": "WebPage",
"@id": pageWebPageId(webPage.url),
@@ -58,9 +56,6 @@ export function buildHomeJsonLdGraph(
mainEntity: {
"@id": JSON_LD_IDS.app,
},
- hasPart: {
- "@id": JSON_LD_IDS.siteNavigation,
- },
},
],
};
diff --git a/src/app/(main)/changelog/[slug]/page.tsx b/src/app/(main)/changelog/[slug]/page.tsx
index 5b4bc28..a988926 100644
--- a/src/app/(main)/changelog/[slug]/page.tsx
+++ b/src/app/(main)/changelog/[slug]/page.tsx
@@ -51,13 +51,14 @@ export async function generateMetadata({
}
const formattedDate = formatChangelogDate(entry.metadata.date);
+ const entryUrl = `https://easyinvoicepdf.com/changelog/${slug}`;
return {
title: entry.metadata.title || `Update ${formattedDate}`,
description: entry.metadata.description,
authors: [{ name: "Vlad Sazonau", url: PERSONAL_WEBSITE_URL }],
alternates: {
- canonical: `https://easyinvoicepdf.com/changelog/${slug}`,
+ canonical: entryUrl,
},
keywords: [
"changelog",
@@ -76,6 +77,7 @@ export async function generateMetadata({
publishedTime: entry.metadata.date,
siteName: "EasyInvoicePDF.com",
locale: "en_US",
+ url: entryUrl,
images: [
{
url: `${STATIC_ASSETS_URL}/easy-invoice-opengraph-image.png?v=1755773879597`,
diff --git a/src/app/(main)/changelog/build-changelog-json-ld.ts b/src/app/(main)/changelog/build-changelog-json-ld.ts
index 9e38ebc..d0c97d5 100644
--- a/src/app/(main)/changelog/build-changelog-json-ld.ts
+++ b/src/app/(main)/changelog/build-changelog-json-ld.ts
@@ -11,7 +11,7 @@ import { buildOrganization, OG_IMAGE_URL } from "@/lib/seo/site-entities";
import { formatChangelogDate, type ChangelogEntry } from "./utils";
-const CHANGELOG_INDEX_URL = `${PROD_WEBSITE_URL}/changelog`;
+export const CHANGELOG_INDEX_URL = `${PROD_WEBSITE_URL}/changelog`;
export const CHANGELOG_INDEX_TITLE =
"EasyInvoicePDF Changelog - Latest Features & Updates";
diff --git a/src/app/(main)/changelog/layout.tsx b/src/app/(main)/changelog/layout.tsx
index 1e9f712..96b370b 100644
--- a/src/app/(main)/changelog/layout.tsx
+++ b/src/app/(main)/changelog/layout.tsx
@@ -11,6 +11,7 @@ import {
import {
CHANGELOG_INDEX_DESCRIPTION,
CHANGELOG_INDEX_TITLE,
+ CHANGELOG_INDEX_URL,
} from "./build-changelog-json-ld";
import { ChangelogIndexJsonLd } from "./changelog-index-json-ld";
@@ -31,7 +32,7 @@ export const metadata: Metadata = {
creator: "Vlad Sazonau",
publisher: "Vlad Sazonau",
alternates: {
- canonical: "https://easyinvoicepdf.com/changelog",
+ canonical: CHANGELOG_INDEX_URL,
},
robots: {
@@ -51,6 +52,7 @@ export const metadata: Metadata = {
siteName: "EasyInvoicePDF.com | Free Invoice PDF Generator",
type: "website",
locale: "en_US",
+ url: CHANGELOG_INDEX_URL,
images: [
{
url: `${STATIC_ASSETS_URL}/easy-invoice-opengraph-image.png?v=1755773879597`,
diff --git a/src/lib/seo/__tests__/home-json-ld.test.ts b/src/lib/seo/__tests__/home-json-ld.test.ts
index 602583c..95d1373 100644
--- a/src/lib/seo/__tests__/home-json-ld.test.ts
+++ b/src/lib/seo/__tests__/home-json-ld.test.ts
@@ -5,14 +5,14 @@ import { buildHomeJsonLdGraph } from "@/app/(main)/(app)/home-json-ld";
import { JSON_LD_IDS } from "../json-ld-ids";
describe("buildHomeJsonLdGraph", () => {
- it("includes full WebSite, Organization, WebApplication, site nav, and WebPage linked by @id", () => {
+ it("includes full WebSite, Organization, WebApplication, and WebPage linked by @id", () => {
const graph = buildHomeJsonLdGraph();
const serializedGraph = JSON.stringify(graph);
const parsed = JSON.parse(serializedGraph) as {
"@graph": Array<Record<string, unknown>>;
};
- expect(parsed["@graph"]).toHaveLength(5);
+ expect(parsed["@graph"]).toHaveLength(4);
const webSite = parsed["@graph"].find((node) => {
return node["@type"] === "WebSite";
@@ -23,9 +23,6 @@ describe("buildHomeJsonLdGraph", () => {
const webApplication = parsed["@graph"].find((node) => {
return node["@type"] === "WebApplication";
});
- const siteNavigation = parsed["@graph"].find((node) => {
- return node["@type"] === "ItemList";
- });
const webPage = parsed["@graph"].find((node) => {
return node["@type"] === "WebPage";
});
@@ -51,29 +48,12 @@ describe("buildHomeJsonLdGraph", () => {
},
});
- expect(siteNavigation).toMatchObject({
- "@id": JSON_LD_IDS.siteNavigation,
- });
-
- expect(siteNavigation?.itemListElement).toEqual(
- expect.arrayContaining([
- expect.objectContaining({
- name: "Start Invoicing",
- item: "https://easyinvoicepdf.com/",
- }),
- expect.objectContaining({
- name: "About",
- item: "https://easyinvoicepdf.com/en/about",
- }),
- ]),
- );
-
expect(webPage).toMatchObject({
"@id": "https://easyinvoicepdf.com/#webpage",
isPartOf: { "@id": JSON_LD_IDS.website },
mainEntity: { "@id": JSON_LD_IDS.app },
- hasPart: { "@id": JSON_LD_IDS.siteNavigation },
});
+ expect(webPage).not.toHaveProperty("hasPart");
});
it("describes the route it is rendered on in its WebPage node", () => {
diff --git a/src/lib/seo/__tests__/site-entities.test.ts b/src/lib/seo/__tests__/site-entities.test.ts
index 43efc3f..8eef925 100644
--- a/src/lib/seo/__tests__/site-entities.test.ts
+++ b/src/lib/seo/__tests__/site-entities.test.ts
@@ -11,7 +11,6 @@ import {
buildFullWebSite,
buildOrganization,
buildPerson,
- buildSiteNavigationList,
buildSiteWideJsonLdGraph,
buildSlimWebSite,
buildWebApplication,
@@ -84,22 +83,6 @@ describe("site-entities", () => {
});
});
- it("should expose primary site navigation links", () => {
- const navigation = buildSiteNavigationList();
- expect(navigation.itemListElement).toEqual(
- expect.arrayContaining([
- expect.objectContaining({
- name: "Start Invoicing",
- item: "https://easyinvoicepdf.com/",
- }),
- expect.objectContaining({
- name: "About",
- item: "https://easyinvoicepdf.com/en/about",
- }),
- ]),
- );
- });
-
it("should emit only slim WebSite in site-wide graph", () => {
const graph = buildSiteWideJsonLdGraph();
expect(graph["@graph"]).toHaveLength(1);
diff --git a/src/lib/seo/json-ld-ids.ts b/src/lib/seo/json-ld-ids.ts
index 2cb789a..bc38d7f 100644
--- a/src/lib/seo/json-ld-ids.ts
+++ b/src/lib/seo/json-ld-ids.ts
@@ -20,7 +20,6 @@ export const JSON_LD_IDS = {
personImage: `${JSON_LD_BASE}/#person-image`,
websiteImage: `${JSON_LD_BASE}/#website-image`,
app: `${JSON_LD_BASE}/#app`,
- siteNavigation: `${JSON_LD_BASE}/#site-navigation`,
blog: `${JSON_LD_BASE}/changelog/#blog`,
} as const;
diff --git a/src/lib/seo/site-entities.ts b/src/lib/seo/site-entities.ts
index 2a63385..32460e4 100644
--- a/src/lib/seo/site-entities.ts
+++ b/src/lib/seo/site-entities.ts
@@ -167,40 +167,6 @@ export function buildWebApplication() {
};
}
-export function buildSiteNavigationList() {
- return {
- "@type": "ItemList" as const,
- "@id": JSON_LD_IDS.siteNavigation,
- name: "Site navigation",
- itemListElement: [
- {
- "@type": "ListItem" as const,
- position: 1,
- name: "Start Invoicing",
- item: START_INVOICING_URL,
- },
- {
- "@type": "ListItem" as const,
- position: 2,
- name: "About",
- item: `${JSON_LD_BASE}/en/about`,
- },
- {
- "@type": "ListItem" as const,
- position: 3,
- name: "Changelog",
- item: `${JSON_LD_BASE}/changelog`,
- },
- {
- "@type": "ListItem" as const,
- position: 4,
- name: "Terms of Service",
- item: `${JSON_LD_BASE}/tos`,
- },
- ],
- };
-}
-
export function buildSiteWideJsonLdGraph() {
return {
"@context": "https://schema.org" as const,