diff --git a/src/assets/images/forrest-gump-quote.png b/src/assets/images/forrest-gump-quote.png new file mode 100644 index 0000000..37bdb35 Binary files /dev/null and b/src/assets/images/forrest-gump-quote.png differ diff --git a/src/content.config.ts b/src/content.config.ts index f9fb498..cfc3501 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -13,12 +13,7 @@ const blog = defineCollection({ featured: z.boolean().optional(), draft: z.boolean().optional(), tags: z.array(z.string()).default(["others"]), - ogImage: image() - .refine(img => img.width >= 1200 && img.height >= 630, { - message: "OpenGraph image must be at least 1200 X 630 pixels!", - }) - .or(z.string()) - .optional(), + ogImage: image().or(z.string()).optional(), description: z.string(), canonicalURL: z.string().optional(), editPost: z diff --git a/src/data/blog/adding-new-post.md b/src/data/blog/adding-new-post.md index c91a560..63ecd7d 100644 --- a/src/data/blog/adding-new-post.md +++ b/src/data/blog/adding-new-post.md @@ -23,19 +23,19 @@ Frontmatter is the main place to store some important information about the blog Here is the list of frontmatter property for each post. -| Property | Description | Remark | -| ------------------ | ------------------------------------------------------------------------------------------- | --------------------------------------------- | -| **_title_** | Title of the post. (h1) | required\* | -| **_description_** | Description of the post. Used in post excerpt and site description of the post. | required\* | -| **_pubDatetime_** | Published datetime in ISO 8601 format. | required\* | -| **_modDatetime_** | Modified datetime in ISO 8601 format. (only add this property when a blog post is modified) | optional | -| **_author_** | Author of the post. | default = SITE.author | -| **_slug_** | Slug for the post. This field is optional. | default = slugified file name | -| **_featured_** | Whether or not display this post in featured section of home page | default = false | -| **_draft_** | Mark this post 'unpublished'. | default = false | -| **_tags_** | Related keywords for this post. Written in array yaml format. | default = others | -| **_ogImage_** | OG image of the post. Useful for social media sharing and SEO. | default = SITE.ogImage or generated OG image | -| **_canonicalURL_** | Canonical URL (absolute), in case the article already exists on other source. | default = `Astro.site` + `Astro.url.pathname` | +| Property | Description | Remark | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------- | +| **_title_** | Title of the post. (h1) | required\* | +| **_description_** | Description of the post. Used in post excerpt and site description of the post. | required\* | +| **_pubDatetime_** | Published datetime in ISO 8601 format. | required\* | +| **_modDatetime_** | Modified datetime in ISO 8601 format. (only add this property when a blog post is modified) | optional | +| **_author_** | Author of the post. | default = SITE.author | +| **_slug_** | Slug for the post. This field is optional. | default = slugified file name | +| **_featured_** | Whether or not display this post in featured section of home page | default = false | +| **_draft_** | Mark this post 'unpublished'. | default = false | +| **_tags_** | Related keywords for this post. Written in array yaml format. | default = others | +| **_ogImage_** | OG image of the post. Useful for social media sharing and SEO. This can be a remote URL or an image path relative to current folder. | default = `SITE.ogImage` or generated OG image | +| **_canonicalURL_** | Canonical URL (absolute), in case the article already exists on other source. | default = `Astro.site` + `Astro.url.pathname` | > Tip! You can get ISO 8601 datetime by running `new Date().toISOString()` in the console. Make sure you remove quotes though. @@ -76,7 +76,8 @@ tags: - some - example - tags -ogImage: "" +ogImage: ../../assets/images/example.png # src/assets/images/example.png +# ogImage: "https://example.org/remote-image.png" # remote URL description: This is the example description of the example post. canonicalURL: https://example.org/my-article-was-already-posted-here --- diff --git a/src/data/blog/how-to-update-dependencies.md b/src/data/blog/how-to-update-dependencies.md index 5f3ceeb..1673a6b 100644 --- a/src/data/blog/how-to-update-dependencies.md +++ b/src/data/blog/how-to-update-dependencies.md @@ -5,7 +5,7 @@ pubDatetime: 2023-07-20T15:33:05.569Z slug: how-to-update-dependencies featured: false draft: false -ogImage: /assets/forrest-gump-quote.webp +ogImage: ../../assets/images/forrest-gump-quote.png tags: - FAQ description: How to update project dependencies and AstroPaper template. @@ -13,7 +13,7 @@ description: How to update project dependencies and AstroPaper template. Updating the dependencies of a project can be tedious. However, neglecting to update project dependencies is not a good idea either 😬. In this post, I will share how I usually update my projects, focusing on AstroPaper as an example. Nonetheless, these steps can be applied to other js/node projects as well. -![Forrest Gump Fake Quote](/assets/forrest-gump-quote.webp) +![Forrest Gump Fake Quote](@/assets/images/forrest-gump-quote.png) ## Table of contents diff --git a/src/data/blog/setting-dates-via-git-hooks.md b/src/data/blog/setting-dates-via-git-hooks.md index aeb4583..00a0e43 100644 --- a/src/data/blog/setting-dates-via-git-hooks.md +++ b/src/data/blog/setting-dates-via-git-hooks.md @@ -155,12 +155,7 @@ const blog = defineCollection({ featured: z.boolean().optional(), draft: z.boolean().optional(), tags: z.array(z.string()).default(["others"]), - ogImage: image() - .refine(img => img.width >= 1200 && img.height >= 630, { - message: "OpenGraph image must be at least 1200 X 630 pixels!", - }) - .or(z.string()) - .optional(), + ogImage: image().or(z.string()).optional(), description: z.string(), canonicalURL: z.string().optional(), readingTime: z.string().optional(),