Skip to content

Commit 5d1947f

Browse files
committed
Hide experimental
1 parent 77ab7de commit 5d1947f

File tree

4 files changed

+52
-35
lines changed

4 files changed

+52
-35
lines changed

content/changelog/v10.3.0.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Version 10.3.0 release notes
33
description: ""
44
date: 2024-08-12T14:16:11.167Z
5-
lastmod: 2024-08-12T14:35:37.260Z
5+
lastmod: 2024-08-13T08:15:59.698Z
66
slug: v10.3.0
77
fmContentType: changelog
88
---
@@ -19,7 +19,15 @@ In the content and media dashboards, we have added a new button to select all it
1919

2020
![Select all items](/releases/v10.3.0/select-all.webp)
2121

22-
## Extensibility: Ability to copy metadata or delete media files
22+
## Extensibility
23+
24+
### UI extensibility is now generally available
25+
26+
The UI extensibility feature is now generally available, which means you do not have to toggle the `frontMatter.experimental` setting anymore.
27+
28+
> **Info**: You can find more information about UI extensibility in the [UI extensibility](/docs/ui-extensibility) documentation.
29+
30+
### Ability to copy metadata or delete media files
2331

2432
Our extensibility library has been extended with new actions which allow you to copy metadata or delete media files. This can be useful when you want to perform certain actions like for example convert a meda file to a different format and keep the metadata.
2533

@@ -29,6 +37,8 @@ New actions:
2937
- `MediaScript.copyMetadataAndDelete(source, destination)`
3038
- `MediaScript.delete(source)`
3139

40+
> **Info**: You can find more information about these actions in the [media scripts](/docs/custom-actions/media-scripts) documentation.
41+
3242
## Related issues/enhancements
3343

3444
### ✨ New features

content/docs/experimental/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ title: Experimental features
33
slug: experimental
44
description: Experimental features in the Front Matter extension.
55
date: 2023-02-12T14:39:58.691Z
6-
lastmod: 2024-02-26T17:52:13.588Z
6+
lastmod: 2024-08-13T08:23:01.804Z
77
weight: 900
8+
hidden: true
89
---
910

1011
# Experimental features

content/docs/experimental/ui-extensibility.md renamed to content/docs/ui-extensibility/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: UI extensibility
3-
slug: experimental/ui-extensibility
3+
slug: ui-extensibility
44
description: UI extensibility in the Front Matter extension.
55
date: 2023-04-01T10:16:59.392Z
6-
lastmod: 2024-02-26T17:52:22.334Z
7-
weight: 900.1
6+
lastmod: 2024-08-13T08:16:56.806Z
7+
weight: 890
88
---
99

1010
# UI extensibility

lib/api.ts

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,66 @@
1-
import fs from 'fs';
2-
import glob from 'glob';
3-
import { join } from 'path';
4-
import matter from 'gray-matter';
1+
import fs from "fs";
2+
import glob from "glob";
3+
import { join } from "path";
4+
import matter from "gray-matter";
55

66
type ContentType = "docs" | "changelog";
77

8-
const postsDirectory = join(process.cwd(), 'content');
8+
const postsDirectory = join(process.cwd(), "content");
99

1010
export function getPostSlugs(type: ContentType) {
11-
return glob.sync(join(postsDirectory, type, '**/*.md')).map(file => file.replace(join(postsDirectory, type, '/'), ''));
11+
return glob
12+
.sync(join(postsDirectory, type, "**/*.md"))
13+
.map((file) => file.replace(join(postsDirectory, type, "/"), ""));
1214
}
1315

14-
export function getPostByFilename(type: ContentType, crntFile: string, fields: string[] = []) {
15-
16-
const realSlug = crntFile.replace(/\.md$/, '');
17-
const fullPath = join(postsDirectory, type, `${realSlug}.md`)
18-
const fileContents = fs.readFileSync(fullPath, 'utf8')
19-
const { data, content } = matter(fileContents)
16+
export function getPostByFilename(
17+
type: ContentType,
18+
crntFile: string,
19+
fields: string[] = []
20+
) {
21+
const realSlug = crntFile.replace(/\.md$/, "");
22+
const fullPath = join(postsDirectory, type, `${realSlug}.md`);
23+
const fileContents = fs.readFileSync(fullPath, "utf8");
24+
const { data, content } = matter(fileContents);
2025

21-
const items: any = {}
26+
const items: any = {};
2227

2328
// Ensure only the minimal needed data is exposed
2429
fields.forEach((field) => {
25-
if (field === 'content') {
26-
items[field] = content
30+
if (field === "content") {
31+
items[field] = content;
2732
}
2833

29-
if (field === 'fileName') {
30-
items[field] = realSlug
34+
if (field === "fileName") {
35+
items[field] = realSlug;
3136
}
32-
33-
if (field === 'slug') {
34-
items[field] = data['slug'] || realSlug
37+
38+
if (field === "slug") {
39+
items[field] = data["slug"] || realSlug;
3540
}
3641

3742
if (data[field]) {
3843
if (data[field] instanceof Date) {
39-
items[field] = (data[field] as Date).toISOString()
44+
items[field] = (data[field] as Date).toISOString();
4045
} else {
41-
items[field] = data[field]
46+
items[field] = data[field];
4247
}
4348
}
44-
})
49+
});
4550

46-
return items
51+
return items;
4752
}
4853

4954
export function getAllPosts(type: ContentType, fields: string[] = []) {
5055
const fileNames = getPostSlugs(type);
51-
56+
5257
const posts = fileNames
53-
.map((fileName) => getPostByFilename(type, fileName, fields))
58+
.map((fileName) => getPostByFilename(type, fileName, [...fields, "hidden"]))
59+
.filter((post) => !post.hidden)
5460
// sort posts by date in descending order
5561
.sort((post1, post2) => {
56-
return (post1 as any)?.date > (post2 as any)?.date ? -1 : 1
62+
return (post1 as any)?.date > (post2 as any)?.date ? -1 : 1;
5763
});
5864

59-
return posts
60-
}
65+
return posts;
66+
}

0 commit comments

Comments
 (0)