(mdPath, locale)
| 76 | |
| 77 | // 将 markdown 路径转换为 URL 路径 |
| 78 | function mdPathToUrl(mdPath, locale) { |
| 79 | // 移除 .md 扩展名 |
| 80 | let urlPath = mdPath.replace(/\.md$/, '') |
| 81 | |
| 82 | // 如果是 index.md,只保留目录 |
| 83 | if (urlPath.endsWith('/index')) { |
| 84 | urlPath = urlPath.slice(0, -6) |
| 85 | } else if (urlPath === 'index') { |
| 86 | urlPath = '' |
| 87 | } |
| 88 | |
| 89 | // 构建完整 URL |
| 90 | return `${siteUrl}/${locale}/${urlPath}${urlPath ? '/' : ''}` |
| 91 | } |
| 92 | |
| 93 | function getGitLastModified(filePath) { |
| 94 | try { |