Skip to content

Commit b31550a

Browse files
authored
Merge pull request #967 from estruyf/beta
10.9.0 merge
2 parents 9ce7754 + b845fd4 commit b31550a

File tree

15 files changed

+1180
-12
lines changed

15 files changed

+1180
-12
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Change Log
22

3+
## [10.9.0] - 2025-07-01 - [Release notes](https://beta.frontmatter.codes/updates/v10.9.0)
4+
5+
### 🎨 Enhancements
6+
7+
- [#962](https://github.com/estruyf/vscode-front-matter/issues/962): Added Simplified Chinese localization thanks to [Randerion(HaoJun0823)](https://github.com/HaoJun0823)
8+
9+
### ⚡️ Optimizations
10+
11+
- [#922](https://github.com/estruyf/vscode-front-matter/issues/922): Added the `{{slugifiedFileName}}` for better naming
12+
13+
### 🐞 Fixes
14+
15+
- [#933](https://github.com/estruyf/vscode-front-matter/issues/933): Timezone setting integration in the DateTime field
16+
- [#942](https://github.com/estruyf/vscode-front-matter/issues/942): Fix to typo on welcome screen thanks to [Stephanie Wertman](https://github.com/stephanie-wertman)
17+
- [#957](https://github.com/estruyf/vscode-front-matter/issues/957): Fix media assets retrieval where `mtime` is not defined. Fallback to the `mtimeMs` property if available.
18+
319
## [10.8.0] - 2025-02-27 - [Release notes](https://beta.frontmatter.codes/updates/v10.8.0)
420

521
### 🎨 Enhancements

l10n/bundle.l10n.zh-cn.json

Lines changed: 821 additions & 0 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Front Matter CMS",
44
"description": "Front Matter is a CMS that runs within Visual Studio Code. It gives you the power and control of a full-blown CMS while also providing you the flexibility and speed of the static site generator of your choice like: Hugo, Jekyll, Docusaurus, NextJs, Gatsby, and many more...",
55
"icon": "assets/frontmatter-teal-128x128.png",
6-
"version": "10.8.0",
6+
"version": "10.9.0",
77
"preview": false,
88
"publisher": "eliostruyf",
99
"galleryBanner": {

package.nls.zh-cn.json

Lines changed: 296 additions & 0 deletions
Large diffs are not rendered by default.

src/helpers/DateHelper.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { parse, parseISO, parseJSON, format } from 'date-fns';
2+
import { formatInTimeZone } from 'date-fns-tz';
23

34
export class DateHelper {
45
public static formatUpdate(value: string | null | undefined): string | null {
@@ -19,6 +20,20 @@ export class DateHelper {
1920
return format(date, DateHelper.formatUpdate(dateFormat) as string);
2021
}
2122

23+
public static formatInTimezone(
24+
date?: Date,
25+
dateFormat?: string,
26+
timezone?: string
27+
): string | null {
28+
if (!date || !dateFormat) {
29+
return null;
30+
}
31+
32+
return timezone
33+
? formatInTimeZone(date, timezone, DateHelper.formatUpdate(dateFormat) as string)
34+
: format(date, DateHelper.formatUpdate(dateFormat) as string);
35+
}
36+
2237
public static tryParse(date: any, format?: string): Date | null {
2338
if (!date) {
2439
return null;

src/helpers/MediaHelpers.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,14 @@ export class MediaHelpers {
172172
}
173173
})
174174
);
175-
files = files.filter((f) => f.mtime !== undefined);
175+
files = files
176+
.filter((f) => f.mtime !== undefined || f.mtimeMs !== undefined)
177+
.map((f) => {
178+
if (f.mtime === undefined && f.mtimeMs !== undefined) {
179+
return { ...f, mtime: new Date(f.mtimeMs as number) };
180+
}
181+
return f;
182+
});
176183

177184
// Sort the files
178185
if (crntSort?.type === SortType.string) {

src/helpers/PanelSettings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
SETTING_GLOBAL_TIMEZONE,
23
SETTING_PANEL_ACTIONS_DISABLED,
34
SETTING_SPONSORS_AI_ENABLED,
45
SETTING_WEBSITE_URL
@@ -68,7 +69,8 @@ export class PanelSettings {
6869
updateFileName: !!Settings.get<boolean>(SETTING_SLUG_UPDATE_FILE_NAME)
6970
},
7071
date: {
71-
format: Settings.get<string>(SETTING_DATE_FORMAT) || ''
72+
format: Settings.get<string>(SETTING_DATE_FORMAT) || '',
73+
timezone: Settings.get<string>(SETTING_GLOBAL_TIMEZONE) || ''
7274
},
7375
tags: (await TaxonomyHelper.get(TaxonomyType.Tag)) || [],
7476
categories: (await TaxonomyHelper.get(TaxonomyType.Category)) || [],

src/helpers/SlugHelper.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ export class SlugHelper {
4040
const fileName = SlugHelper.slugify(file.name);
4141
const regex = new RegExp('{{sluggedFileName}}', 'g');
4242
slugTemplate = slugTemplate.replace(regex, fileName);
43+
} else if (slugTemplate.includes(`{{slugifiedFileName}}`)) {
44+
const file = parse(filePath || '');
45+
const fileName = SlugHelper.slugify(file.name);
46+
const regex = new RegExp('{{slugifiedFileName}}', 'g');
47+
slugTemplate = slugTemplate.replace(regex, fileName);
4348
}
4449

4550
const dateFormat = Settings.get(SETTING_DATE_FORMAT) as string;

src/listeners/dashboard/SsgListener.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ export class SsgListener extends BaseListener {
114114
}
115115

116116
// https://github.com/withastro/astro/blob/defab70cb2a0c67d5e9153542490d2749046b151/packages/astro/src/content/utils.ts#L450
117-
const contentConfig = await workspace.findFiles(`**/src/content/config.*`);
117+
let contentConfig = await workspace.findFiles(`**/src/content/config.*`);
118+
119+
// Also search for content.config.* files (newer pattern)
120+
if (contentConfig.length === 0) {
121+
contentConfig = await workspace.findFiles(`**/content.config.*`);
122+
}
118123

119124
if (contentConfig.length === 0) {
120125
SsgListener.sendRequest(command as any, requestId, []);

0 commit comments

Comments
 (0)