Configure Keystatic for release images (#10889)
- Add validation for the `release` field of the releases collection - The `release` must follow semver format - The `slug` matches the `release` by default and must follow semver format, too - Order the releases properly - `0.10.0` appears before `0.3.0`; I made the comparison against `0000.0010.0000` and `0000.0003.0000` - Set up images for release's contents - Refactor the release notes of the version `0.43.0` to be editable in Keystatic; it will serve as an example ## Demo https://github.com/user-attachments/assets/d82851e9-11e7-4e27-b645-cf86a93d77bf
This commit is contained in:
committed by
GitHub
parent
3d34f477f9
commit
f5195433f3
@ -38,13 +38,43 @@ export default config({
|
|||||||
path: 'src/content/releases/*',
|
path: 'src/content/releases/*',
|
||||||
format: { contentField: 'content' },
|
format: { contentField: 'content' },
|
||||||
schema: {
|
schema: {
|
||||||
release: fields.slug({ name: { label: 'Release' } }),
|
release: fields.slug({
|
||||||
|
name: {
|
||||||
|
label: 'Release',
|
||||||
|
validation: {
|
||||||
|
pattern: {
|
||||||
|
regex: /^\d+\.\d+\.\d+$/,
|
||||||
|
message: 'The release must be in the format major.minor.patch',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
slug: {
|
||||||
|
generate: (name) => name,
|
||||||
|
validation: {
|
||||||
|
pattern: {
|
||||||
|
regex: /^\d+\.\d+\.\d+$/,
|
||||||
|
message: 'The release must be in the format major.minor.patch',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
// TODO: Define the date with a normalized format
|
// TODO: Define the date with a normalized format
|
||||||
Date: fields.text({ label: 'Date' }),
|
Date: fields.text({ label: 'Date' }),
|
||||||
content: fields.mdx({
|
content: fields.mdx({
|
||||||
label: 'Content',
|
label: 'Content',
|
||||||
|
options: {
|
||||||
|
image: {
|
||||||
|
directory: 'public/images/releases',
|
||||||
|
publicPath: '/images/releases/',
|
||||||
|
},
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
parseSlugForSort: (slug) => {
|
||||||
|
const [major, minor, patch] = slug.split('.');
|
||||||
|
|
||||||
|
return `${major.padStart(4, '0')}.${minor.padStart(4, '0')}.${patch.padStart(4, '0')}`;
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
@ -7,10 +7,10 @@ Date: March 4th 2025
|
|||||||
|
|
||||||
The search feature now includes ranking scores. This helps you find the most relevant results faster.
|
The search feature now includes ranking scores. This helps you find the most relevant results faster.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# Internal Email Privacy
|
# Internal Email Privacy
|
||||||
|
|
||||||
Internal team emails won't sync, protecting privacy by preventing access to internal discussions.
|
Internal team emails won't sync, protecting privacy by preventing access to internal discussions.
|
||||||
|
|
||||||

|

|
||||||
Reference in New Issue
Block a user