Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions website/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ const copy = {
const languageOptions = document.querySelectorAll(".language-option");
const heroAppScreen = document.querySelector("#hero-app-screen");
const privacyLink = document.querySelector("#privacy-link");
const siteURL = "https://ixiehao.github.io/MP4Flow/";
const localeURLs = {
zh: siteURL,
en: `${siteURL}?lang=en`,
ja: `${siteURL}?lang=ja`
};
const requestedLanguage = new URLSearchParams(window.location.search).get("lang");
const browserLanguage = navigator.language.toLowerCase();
let language = ["zh", "en", "ja"].includes(requestedLanguage)
Expand All @@ -90,6 +96,21 @@ function setMeta(selector, value) {
if (meta) meta.setAttribute("content", value);
}

function setLink(selector, value) {
const link = document.querySelector(selector);
if (link) link.setAttribute("href", value);
}

function updateSoftwareSchema(translations) {
const schemaNode = document.querySelector("#software-schema");
if (!schemaNode) return;
const schema = JSON.parse(schemaNode.textContent);
schema.url = localeURLs[language];
schema.description = translations.pageDescription;
schema.inLanguage = language === "zh" ? "zh-CN" : language;
schemaNode.textContent = JSON.stringify(schema);
}

function applyLanguage(nextLanguage) {
language = nextLanguage;
const translations = copy[language];
Expand All @@ -98,11 +119,14 @@ function applyLanguage(nextLanguage) {
setMeta('meta[name="description"]', translations.pageDescription);
setMeta('meta[property="og:title"]', translations.ogTitle);
setMeta('meta[property="og:description"]', translations.ogDescription);
setMeta('meta[property="og:url"]', localeURLs[language]);
setMeta('meta[property="og:locale"]', translations.ogLocale);
setMeta('meta[property="og:image:alt"]', translations.socialImageAlt);
setMeta('meta[name="twitter:title"]', translations.ogTitle);
setMeta('meta[name="twitter:description"]', translations.ogDescription);
setMeta('meta[name="twitter:image:alt"]', translations.socialImageAlt);
setLink('link[rel="canonical"]', localeURLs[language]);
updateSoftwareSchema(translations);
heroAppScreen.src = language === "zh" ? heroAppScreen.dataset.srcZh : language === "ja" ? heroAppScreen.dataset.srcJa : heroAppScreen.dataset.srcEn;
heroAppScreen.alt = translations.stageAlt;
document.querySelectorAll("[data-i18n]").forEach((element) => {
Expand Down
10 changes: 7 additions & 3 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
<meta name="theme-color" content="#071a3e" />
<meta name="description" content="MP4Flow:免费开源的原生 macOS 视频转 MP4 工具。智能转换、剪切、裁切、旋转,全部本地完成。" />
<meta name="keywords" content="macOS 视频转 MP4, Mac 视频转换器, 智能转换, 视频剪切, 视频裁切, 视频旋转, 免费视频转换器, 开源视频转换器, FFmpeg, MP4Flow" />
<meta name="author" content="ixiehao" />
<meta name="robots" content="index,follow,max-image-preview:large" />
<link rel="canonical" href="https://ixiehao.github.io/MP4Flow/" />
<link id="canonical-url" rel="canonical" href="https://ixiehao.github.io/MP4Flow/" />
<link rel="alternate" hreflang="zh-CN" href="https://ixiehao.github.io/MP4Flow/" />
<link rel="alternate" hreflang="en" href="https://ixiehao.github.io/MP4Flow/?lang=en" />
<link rel="alternate" hreflang="ja" href="https://ixiehao.github.io/MP4Flow/?lang=ja" />
<link rel="alternate" hreflang="x-default" href="https://ixiehao.github.io/MP4Flow/" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://ixiehao.github.io/MP4Flow/" />
<meta id="og-url" property="og:url" content="https://ixiehao.github.io/MP4Flow/" />
<meta property="og:site_name" content="MP4Flow" />
<meta property="og:locale" content="zh_CN" />
<meta property="og:locale:alternate" content="en_US" />
Expand All @@ -35,19 +36,22 @@
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/mp4flow-app-icon.png" />
<link rel="apple-touch-icon" href="assets/mp4flow-app-icon.png" />
<link rel="stylesheet" href="styles.css?v=20261016.4" />
<script type="application/ld+json">
<script id="software-schema" type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"@id": "https://ixiehao.github.io/MP4Flow/#software",
"name": "MP4Flow",
"applicationCategory": "UtilitiesApplication",
"operatingSystem": "macOS 13 or later",
"description": "A free and open-source native macOS video-to-MP4 converter with Smart Convert, trim, crop, rotate, and local processing.",
"url": "https://ixiehao.github.io/MP4Flow/",
"downloadUrl": "https://github.com/ixiehao/MP4Flow/releases/latest",
"codeRepository": "https://github.com/ixiehao/MP4Flow",
"license": "https://github.com/ixiehao/MP4Flow/blob/main/LICENSE",
"isAccessibleForFree": true,
"inLanguage": ["zh-CN", "en", "ja"],
"author": { "@type": "Person", "name": "ixiehao", "url": "https://github.com/ixiehao" },
"featureList": "Smart video conversion, trim, crop, rotate, batch conversion, local processing, and Apple VideoToolbox acceleration.",
"offers": {
"@type": "Offer",
Expand Down
27 changes: 23 additions & 4 deletions website/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://ixiehao.github.io/MP4Flow/</loc>
<lastmod>2026-09-25</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
<lastmod>2026-10-16</lastmod>
<xhtml:link rel="alternate" hreflang="zh-CN" href="https://ixiehao.github.io/MP4Flow/" />
<xhtml:link rel="alternate" hreflang="en" href="https://ixiehao.github.io/MP4Flow/?lang=en" />
<xhtml:link rel="alternate" hreflang="ja" href="https://ixiehao.github.io/MP4Flow/?lang=ja" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://ixiehao.github.io/MP4Flow/" />
</url>
<url>
<loc>https://ixiehao.github.io/MP4Flow/?lang=en</loc>
<lastmod>2026-10-16</lastmod>
<xhtml:link rel="alternate" hreflang="zh-CN" href="https://ixiehao.github.io/MP4Flow/" />
<xhtml:link rel="alternate" hreflang="en" href="https://ixiehao.github.io/MP4Flow/?lang=en" />
<xhtml:link rel="alternate" hreflang="ja" href="https://ixiehao.github.io/MP4Flow/?lang=ja" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://ixiehao.github.io/MP4Flow/" />
</url>
<url>
<loc>https://ixiehao.github.io/MP4Flow/?lang=ja</loc>
<lastmod>2026-10-16</lastmod>
<xhtml:link rel="alternate" hreflang="zh-CN" href="https://ixiehao.github.io/MP4Flow/" />
<xhtml:link rel="alternate" hreflang="en" href="https://ixiehao.github.io/MP4Flow/?lang=en" />
<xhtml:link rel="alternate" hreflang="ja" href="https://ixiehao.github.io/MP4Flow/?lang=ja" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://ixiehao.github.io/MP4Flow/" />
</url>
</urlset>
Loading