Skip to content

Commit cce2559

Browse files
feat(website): add bilingual Finder creation pages
1 parent a4a472e commit cce2559

7 files changed

Lines changed: 127 additions & 9 deletions

File tree

‎specs/domains/presentation.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,12 @@ owns the rules, supported storage, counts, explicit actions and recovery behavio
427427
address, and reciprocal language links only for existing translations. Generate
428428
a sitemap with the production base path; exclude 404 pages and mark them noindex.
429429
Search metadata adds no tracking or build-time network requests.
430+
- Provide a bilingual Finder file-creation page at `new-file.html` and
431+
`en/new-file.html`, linked from the homepage creation scenario and tool
432+
overview. Show the matching-language Finder menu in the page and its social
433+
preview. Explain how to enable the extension, select a working folder, and
434+
create text or Office files from enabled templates. Use the existing stable
435+
release download link and link to the installation and detailed setup guides.
430436
- Both README languages and website homepages show a future roadmap as grouped
431437
TODO checklists. Describe concrete user outcomes without priorities, release
432438
assignments or delivery dates, and distinguish planned work from available

‎website/.vitepress/config.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ export default defineConfig({
2424
const englishSource = `en/${chineseSource}`
2525
const translatedSource = english ? chineseSource : englishSource
2626
const canonical = pageUrl(pageData.relativePath)
27-
const cover = new URL(`images/current/workspaces-${english ? 'en' : 'zh'}.jpg`, siteUrl).href
27+
const language = english ? 'en' : 'zh'
28+
const finderCreation = chineseSource === 'new-file.md'
29+
const coverPath = finderCreation
30+
? `images/finder-create-menu-${language}.jpg`
31+
: `images/current/workspaces-${language}.jpg`
32+
const cover = new URL(coverPath, siteUrl).href
2833
const head: HeadConfig[] = [
2934
['link', { rel: 'canonical', href: canonical }],
3035
['meta', { property: 'og:type', content: 'website' }],
3136
['meta', { property: 'og:image', content: cover }],
3237
['meta', { property: 'og:image:type', content: 'image/jpeg' }],
33-
['meta', { property: 'og:image:width', content: '1520' }],
34-
['meta', { property: 'og:image:height', content: '760' }],
38+
['meta', { property: 'og:image:width', content: finderCreation ? '920' : '1520' }],
39+
['meta', { property: 'og:image:height', content: finderCreation ? '365' : '760' }],
3540
['meta', { name: 'twitter:image', content: cover }],
3641
['meta', { property: 'og:site_name', content: 'FileMint' }],
3742
['meta', { property: 'og:title', content: title }],

‎website/.vitepress/theme/LandingPage.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const workspaces = computed(() => ({
2727
line: t('在当前目录', 'A new file,'), accent: t('写下第一行。', 'right here.'),
2828
text: t('在 Finder 的文件夹空白处点右键,选「新建文件…」。填好文件名、格式和第一段内容,按 ⌘↩ 创建。', 'Right-click the background of a Finder folder and choose New File…. Set the name and format, write the first few lines, then press ⌘↩ to create.'),
2929
photo: capture('create', 1160, 1120, '新建文件面板中的名称、格式、保存位置与内容编辑区', 'The New File panel with name, format, destination and starter content'),
30-
link: guide('自己填写名称与内容', 'choose-the-name-and-starter-content')
30+
link: page('new-file')
3131
},
3232
templates: {
3333
label: t('模板库', 'Templates'), name: t('模板与类型', 'Templates & Types'),

‎website/.vitepress/theme/style.css‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@
3737
.VPDoc .vp-doc :is(h1, h2, h3) { text-wrap: pretty; }
3838
.VPDoc .vp-doc p img { border-radius: 8px; margin-inline: auto; max-height: 510px; object-fit: contain; }
3939

40+
.new-file-page .new-file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 24px; }
41+
.new-file-page .new-file-download {
42+
display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 7px;
43+
background: var(--vp-button-brand-bg); color: var(--vp-button-brand-text); text-decoration: none;
44+
}
45+
.new-file-page .new-file-download:hover { background: var(--vp-button-brand-hover-bg); color: var(--vp-button-brand-hover-text); }
46+
.new-file-page .new-file-menu { margin: 24px 0 0; }
47+
.new-file-page .new-file-menu img { display: block; width: 100%; height: auto; border-radius: 8px; }
48+
.new-file-page .new-file-menu figcaption { margin-top: 8px; color: var(--vp-c-text-2); font-size: 14px; }
49+
4050
.mint-home { --ink: var(--vp-c-text-1); --muted: var(--vp-c-text-2); color: var(--ink); }
4151
.mint-home *, .mint-home *::before, .mint-home *::after { box-sizing: border-box; }
4252
.mint-home :is(h1, h2, h3, p, figure, dl, dt, dd, ul, li) { margin: 0; padding: 0; border: 0; }

‎website/en/new-file.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Create a new file from Finder’s right-click menu
3+
description: Add a New File menu to Finder on your Mac. Create TXT, Markdown, Word and Excel files in the current folder with FileMint’s native Finder extension.
4+
pageClass: new-file-page
5+
aside: false
6+
---
7+
8+
<script setup>
9+
import { withBase } from 'vitepress'
10+
import { LATEST_RELEASE_URL } from '../.vitepress/theme/release.mjs'
11+
</script>
12+
13+
# Create a new file from Finder’s right-click menu
14+
15+
Right-click the background of a Finder folder and pick TXT, Markdown, Word or Excel from the **New File** menu. FileMint creates the new file in that folder.
16+
17+
<div class="new-file-actions">
18+
<a class="new-file-download" :href="LATEST_RELEASE_URL">Download for Mac</a>
19+
<a :href="withBase('/en/install.html')">Installation guide</a>
20+
</div>
21+
22+
M-series Macs · macOS 13.0 or later · Free for personal and non-commercial use
23+
24+
<figure class="new-file-menu">
25+
<img :src="withBase('/images/finder-create-menu-en.jpg')" width="920" height="365" fetchpriority="high" alt="The New File submenu in Finder’s context menu, showing Text and Markdown options.">
26+
<figcaption>This menu shows Text and Markdown. Choose which formats appear in Templates &amp; Types.</figcaption>
27+
</figure>
28+
29+
## Create your first file
30+
31+
1. Open FileMint and go to **Finder & Folders**. Follow the prompt to enable the Finder extension and check that your working folder is in the menu scope.
32+
2. In Finder, right-click the **folder background** and choose **New File → Markdown (.md)** or another enabled format.
33+
3. If macOS asks for access, confirm the folder in the system picker. The file appears in the folder where you clicked.
34+
35+
To set the name and write the first few lines, choose **New File…** and fill in the draft. [See the Finder setup steps](./guide#complete-the-first-time-setup)
36+
37+
## Start from a Word or Excel template
38+
39+
Choose **Word Document** or **Excel Workbook** in the New File menu for a blank document or a workbook with one blank worksheet. Both are enabled on a fresh install. FileMint can create these files without Microsoft Office installed.
40+
41+
To reuse your own report or budget sheet, import a `.docx` or `.xlsx` under **Templates & Types → Manage → Import Document Template…**. FileMint stores a copy on your Mac. The next document you create from that template starts with its content and formatting. [See how document templates work](./guide#create-word-excel-in-finder)

‎website/new-file.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Mac Finder 右键新建文件
3+
description: 在 Mac 的 Finder 右键菜单直接新建 TXT、Markdown、Word 或 Excel 文件。查看 FileMint 的实机菜单、安装步骤和模板用法。
4+
pageClass: new-file-page
5+
aside: false
6+
---
7+
8+
<script setup>
9+
import { withBase } from 'vitepress'
10+
import { LATEST_RELEASE_URL } from './.vitepress/theme/release.mjs'
11+
</script>
12+
13+
# Mac Finder 右键新建文件
14+
15+
在 Finder 的文件夹空白处右键,从 **新建文件** 里选 TXT、Markdown、Word 或 Excel。新文件会直接出现在当前目录。
16+
17+
<div class="new-file-actions">
18+
<a class="new-file-download" :href="LATEST_RELEASE_URL">下载 macOS 版</a>
19+
<a :href="withBase('/install.html')">查看安装步骤</a>
20+
</div>
21+
22+
M 系列 Mac · macOS 13.0 及以上 · 个人及非商业使用免费
23+
24+
<figure class="new-file-menu">
25+
<img :src="withBase('/images/finder-create-menu-zh.jpg')" width="920" height="365" fetchpriority="high" alt="Finder 右键菜单展开了「新建文件」子菜单,其中有文本和 Markdown 选项。">
26+
<figcaption>示例菜单显示文本和 Markdown。可在「模板与类型」中选择菜单里出现的格式。</figcaption>
27+
</figure>
28+
29+
## 创建第一份文件
30+
31+
1. 打开 FileMint,在 **Finder 与文件夹** 按提示启用 Finder 扩展,并确认当前文件夹在菜单显示范围内。
32+
2. 回到 Finder,在该文件夹的**空白处**右键,选择 **新建文件 → Markdown (.md)** 或其他已启用的格式。
33+
3. 如果 macOS 提示授权,在系统选择器中确认该文件夹。创建完成后,文件会出现在你刚才右键的位置。
34+
35+
想先写好名字和内容,可以选 **新建文件…**,再填写文件名、格式与正文。[查看 Finder 首次设置](./guide#先完成首次设置)
36+
37+
## 用 Word 或 Excel 模板
38+
39+
右键选择 **Word 文档** 或 **Excel 工作簿**,即可创建空白文档或含一个空白工作表的工作簿。两项在全新安装时默认启用。生成这些文件无需安装 Microsoft Office。
40+
41+
也可以在 **模板与类型 → 管理 → 导入文档模板…** 导入自己的 `.docx` 或 `.xlsx`。FileMint 会在本机保存模板副本,下次右键新建时沿用它的内容和格式。[查看文档模板用法](./guide#create-word-excel-in-finder)

‎website/tests/seo.test.mjs‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import config from '../.vitepress/config.ts'
66
const site = 'https://filemintapp.github.io/FileMint/'
77
const pairs = [
88
['index.md', ''],
9+
['new-file.md', 'new-file.html'],
910
['guide.md', 'guide.html'],
1011
['install.md', 'install.html'],
1112
['privacy.md', 'privacy.html']
@@ -58,11 +59,25 @@ test('404 pages are noindex without a canonical or language alternative', async
5859

5960
test('sitemap uses the official production base and excludes error pages', () => {
6061
assert.equal(config.sitemap.hostname, site)
61-
const pages = ['', 'en/', 'guide.html', 'en/guide.html', '404.html', 'en/404.html']
62-
.map((url) => ({ url }))
63-
assert.deepEqual(config.sitemap.transformItems(pages).map(({ url }) => url), [
64-
'', 'en/', 'guide.html', 'en/guide.html'
65-
])
62+
const publicPages = ['', 'en/', 'new-file.html', 'en/new-file.html', 'guide.html', 'en/guide.html']
63+
const pages = [...publicPages, '404.html', 'en/404.html'].map((url) => ({ url }))
64+
assert.deepEqual(config.sitemap.transformItems(pages).map(({ url }) => url), publicPages)
65+
})
66+
67+
test('Finder file creation pages share the same localized menu shown on the page', async () => {
68+
for (const [language, relativePath] of [['zh', 'new-file.md'], ['en', 'en/new-file.md']]) {
69+
const head = await config.transformHead({
70+
pageData: { relativePath }, title: 'Create files in Finder', description: ''
71+
})
72+
const path = `images/finder-create-menu-${language}.jpg`
73+
const image = site + path
74+
for (const [property, content] of [
75+
['og:image', image], ['og:image:width', '920'], ['og:image:height', '365']
76+
]) assert.deepEqual(entries(head, 'meta', 'property', property), [{ property, content }])
77+
assert.deepEqual(entries(head, 'meta', 'name', 'twitter:image'), [{ name: 'twitter:image', content: image }])
78+
assert.ok(statSync(new URL('../public/' + path, import.meta.url)).size > 0)
79+
assert.ok(readFileSync(new URL('../' + relativePath, import.meta.url), 'utf8').includes('/' + path))
80+
}
6681
})
6782

6883
test('sharing a translated page uses the matching README cover at the production URL', async () => {

0 commit comments

Comments
 (0)