diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/content/blog/create-lib-file-from-dll.md | 3 | ||||
-rw-r--r-- | src/content/config.ts | 1 | ||||
-rw-r--r-- | src/pages/404.astro | 6 | ||||
-rw-r--r-- | src/pages/blog/[...slug].astro | 13 | ||||
-rw-r--r-- | src/pages/index.astro | 6 | ||||
-rw-r--r-- | src/utils/schemas/blogPostSchema.ts | 4 | ||||
-rw-r--r-- | src/utils/schemas/blogSchema.ts | 2 | ||||
-rw-r--r-- | src/utils/schemas/pageSchema.ts | 23 | ||||
-rw-r--r-- | src/utils/schemas/websiteSchema.ts | 15 |
9 files changed, 46 insertions, 27 deletions
diff --git a/src/content/blog/create-lib-file-from-dll.md b/src/content/blog/create-lib-file-from-dll.md index 472ae23..306c9b7 100644 --- a/src/content/blog/create-lib-file-from-dll.md +++ b/src/content/blog/create-lib-file-from-dll.md @@ -1,9 +1,10 @@ --- +basedOn: "https://adrianhenke.wordpress.com/2008/12/05/create-lib-file-from-dll/" title: 'Create ".lib" file from ".dll" (archive)' description: "Learn how to generate a *.lib file from a *.dll with this comprehensive guide. Using the Visual Studio Command Prompt and Microsoft's recommended tools, this article walks you through the steps for a seamless process. Perfect for developers working with 3rd party win dll's." datePublished: "2023-05-04" dateModified: "2023-05-04" -author: "Adrian Henke" +author: "Valentin Popov" lang: "en" --- diff --git a/src/content/config.ts b/src/content/config.ts index d7f5f86..916e412 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -4,6 +4,7 @@ const blog = defineCollection({ type: "content", schema: z.object({ author: z.string(), + basedOn: z.optional(z.string()), dateModified: z.coerce.date(), datePublished: z.coerce.date(), description: z.string(), diff --git a/src/pages/404.astro b/src/pages/404.astro index 072c6e7..cb3fca1 100644 --- a/src/pages/404.astro +++ b/src/pages/404.astro @@ -1,15 +1,17 @@ --- import Layout from "../layouts/BaseLayout.astro"; -import websiteSchema from "../utils/schemas/websiteSchema"; +import pageSchema from "../utils/schemas/pageSchema"; const title = "404 — Page Not Found | Valentin Popov"; const description = "The page you're looking for doesn't exist!"; const lang = "en"; -const schema = websiteSchema({ +const schema = pageSchema({ siteUrl: new URL("/", Astro.site).toString(), + page: "/404", title, description, + lang, }); --- diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index deb98ac..39207dd 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -22,15 +22,16 @@ const post = Astro.props; const { Content, remarkPluginFrontmatter } = await post.render(); -const title = post.data.title; -const description = post.data.description; const author = post.data.author; +const description = post.data.description; +const isBasedOn = post.data.basedOn; const lang = post.data.lang; +const slug = post.slug; +const title = post.data.title; -const formattedDate = dayjs(post.data.datePublished.toString()).format("MMMM DD, YYYY"); -const datePublished = post.data.datePublished.toISOString(); const dateModified = post.data.dateModified?.toISOString(); -const slug = post.slug; +const datePublished = post.data.datePublished.toISOString(); +const formattedDate = dayjs(post.data.datePublished.toString()).format("MMMM DD, YYYY"); const schema = blogPostSchema({ siteUrl: new URL("/", Astro.site).toString(), @@ -41,6 +42,7 @@ const schema = blogPostSchema({ dateModified, author, lang, + isBasedOn, }); --- @@ -61,7 +63,6 @@ const schema = blogPostSchema({ <small> Posted <time datetime={datePublished} lang="en">{formattedDate}</time> - by {author} <span> • </span> <span>{remarkPluginFrontmatter.minutesRead}</span> </small> diff --git a/src/pages/index.astro b/src/pages/index.astro index eaa5298..b72c55a 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -3,16 +3,18 @@ import Layout from "../layouts/BaseLayout.astro"; import LatestPostsSection from "../components/Sections/LatestPosts.astro"; import SocialLinksSection from "../components/Sections/SocialLinks.astro"; import WelcomeSection from "../components/Sections/Welcome.astro"; -import websiteSchema from "../utils/schemas/websiteSchema"; +import pageSchema from "../utils/schemas/pageSchema"; const title = "Valentin Popov – Software Developer & Team Lead | Tech Insights"; const description = "Blog by Valentin Popov — software developer and team lead writing about code, side projects, digital tools, and fun experiments."; const lang = "en"; -const schema = websiteSchema({ +const schema = pageSchema({ siteUrl: new URL("/", Astro.site).toString(), + page: "/", title, description, + lang, }); --- diff --git a/src/utils/schemas/blogPostSchema.ts b/src/utils/schemas/blogPostSchema.ts index 00395dd..9445448 100644 --- a/src/utils/schemas/blogPostSchema.ts +++ b/src/utils/schemas/blogPostSchema.ts @@ -5,13 +5,14 @@ export type BlogPostSchemaParams = { readonly dateModified: string; readonly datePublished: string; readonly description: string; + readonly isBasedOn?: string; readonly lang: string; readonly siteUrl: string; readonly slug: string; readonly title: string; }; -export default ({ siteUrl, slug, title, description, datePublished, dateModified, author, lang }: BlogPostSchemaParams): WithContext<BlogPosting> => ({ +export default ({ siteUrl, slug, title, description, datePublished, dateModified, author, lang, isBasedOn }: BlogPostSchemaParams): WithContext<BlogPosting> => ({ "@context": "https://schema.org", "@type": "BlogPosting", "url": new URL(`/blog/${slug}`, siteUrl).toString(), @@ -28,4 +29,5 @@ export default ({ siteUrl, slug, title, description, datePublished, dateModified "@type": "WebPage", "@id": new URL(`/blog/${slug}`, siteUrl).toString(), }, + ...(isBasedOn && { isBasedOn: isBasedOn }), }); diff --git a/src/utils/schemas/blogSchema.ts b/src/utils/schemas/blogSchema.ts index 66a9bae..77f4632 100644 --- a/src/utils/schemas/blogSchema.ts +++ b/src/utils/schemas/blogSchema.ts @@ -14,6 +14,8 @@ export default ({ siteUrl, title, posts }: BlogSchemaParams): WithContext<Collec "name": title, "mainEntity": { "@type": "ItemList", + "itemListOrder": "https://schema.org/ItemListOrderDescending", + "numberOfItems": posts.length, "itemListElement": posts.map((post, index) => ({ "@type": "ListItem", "position": index + 1, diff --git a/src/utils/schemas/pageSchema.ts b/src/utils/schemas/pageSchema.ts new file mode 100644 index 0000000..606488b --- /dev/null +++ b/src/utils/schemas/pageSchema.ts @@ -0,0 +1,23 @@ +import type { WithContext, WebPage } from "schema-dts"; + +export type WebsiteSchemaParams = { + readonly description: string; + readonly page: string; + readonly siteUrl: string; + readonly title: string; + readonly lang: string; +}; + +export default ({ siteUrl, page, title, description, lang }: WebsiteSchemaParams): WithContext<WebPage> => ({ + "@context": "https://schema.org", + "@type": "WebPage", + "@id": new URL(page, siteUrl).toString(), + "url": new URL(page, siteUrl).toString(), + "name": title, + "description": description, + "inLanguage": lang, + "mainEntity": { + "@type": "WebSite", + "@id": new URL("/", siteUrl).toString(), + }, +}); diff --git a/src/utils/schemas/websiteSchema.ts b/src/utils/schemas/websiteSchema.ts deleted file mode 100644 index b971e5e..0000000 --- a/src/utils/schemas/websiteSchema.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { WithContext, WebSite } from "schema-dts"; - -export type WebsiteSchemaParams = { - readonly description: string; - readonly siteUrl: string; - readonly title: string; -}; - -export default ({ siteUrl, title, description }: WebsiteSchemaParams): WithContext<WebSite> => ({ - "@context": "https://schema.org", - "@type": "WebSite", - "url": new URL("/", siteUrl).toString(), - "name": title, - "description": description, -}); |