mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
fix: remove unused ogImage size validation (#462)
* fix: remove unused ogImage size validation Validation of `ogImage` field in blog collection causes unintentional broken og images after the build. Removing the validation solve the issue. * docs: update docs for ogImage path * chore: update asset
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 275 KiB |
@@ -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
|
||||
|
||||
@@ -24,7 +24,7 @@ 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<sup>\*</sup> |
|
||||
| **_description_** | Description of the post. Used in post excerpt and site description of the post. | required<sup>\*</sup> |
|
||||
| **_pubDatetime_** | Published datetime in ISO 8601 format. | required<sup>\*</sup> |
|
||||
@@ -34,7 +34,7 @@ Here is the list of frontmatter property for each post.
|
||||
| **_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 |
|
||||
| **_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
|
||||
---
|
||||
|
||||
@@ -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.
|
||||
|
||||

|
||||

|
||||
|
||||
## Table of contents
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user