From 996ff7756dc80613c7be6bfc84413ed2a750912c Mon Sep 17 00:00:00 2001 From: LauraGPT Date: Mon, 27 Jul 2026 00:47:11 +0000 Subject: [PATCH] feat(site): attribute repository conversions Signed-off-by: LauraGPT --- docs/operations/funasr-com-site-release.md | 13 +++++++++++++ web-pages/product-site/build.py | 6 +++++- web-pages/product-site/templates/base.html | 5 +++-- web-pages/product-site/tests/test_build.py | 20 ++++++++++++++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/docs/operations/funasr-com-site-release.md b/docs/operations/funasr-com-site-release.md index 3db3c62c6..cdfef919e 100644 --- a/docs/operations/funasr-com-site-release.md +++ b/docs/operations/funasr-com-site-release.md @@ -75,6 +75,12 @@ kill -HUP ## Monitoring +Visible repository, documentation, and release links use the fixed `/go/github`, +`/go/docs`, and `/go/releases` routes. The JSON-LD `codeRepository` value remains +the direct GitHub URL so attribution does not change search metadata. Redirect +targets are defined only in `web-pages/nginx/conversion-map.conf`; never accept a +target from a query parameter. + Check after one hour and again after 24 hours: ```bash @@ -85,4 +91,11 @@ curl -fsSI https://www.funasr.com/deploy/vllm.html curl -fsSI https://www.funasr.com/blog/ ``` +Count non-smoke conversion requests by route: + +```bash +grep -vE '"(FunASR release smoke|curl/)' /var/log/nginx/funasr-conversions.log \ + | awk '{print $7}' | sort | uniq -c | sort -nr +``` + Roll back on elevated 5xx responses, missing indexed routes, mobile overflow, missing assets, invalid conversion redirects, or a failed static validation. diff --git a/web-pages/product-site/build.py b/web-pages/product-site/build.py index 4b5b209c5..020b29f6e 100644 --- a/web-pages/product-site/build.py +++ b/web-pages/product-site/build.py @@ -21,6 +21,7 @@ SITE_ROOT = Path(__file__).resolve().parent BASE_URL = 'https://www.funasr.com' +GITHUB_REPOSITORY_URL = 'https://github.com/modelscope/FunASR' def sha256(path: Path) -> str: @@ -129,7 +130,10 @@ def _page_context( 'description': description, 'navigation': _navigation(navigation, language), 'assets': assets, - 'github_url': 'https://github.com/modelscope/FunASR', + 'github_repository_url': GITHUB_REPOSITORY_URL, + 'github_url': '/go/github', + 'docs_url': '/go/docs', + 'releases_url': '/go/releases', } diff --git a/web-pages/product-site/templates/base.html b/web-pages/product-site/templates/base.html index be7309ed1..7bf6c1c48 100644 --- a/web-pages/product-site/templates/base.html +++ b/web-pages/product-site/templates/base.html @@ -21,7 +21,7 @@ 'applicationCategory': 'DeveloperApplication', 'operatingSystem': 'Linux, macOS, Windows', 'url': canonical, - 'codeRepository': github_url, + 'codeRepository': github_repository_url, 'license': 'https://www.apache.org/licenses/LICENSE-2.0' } | tojson }} @@ -60,7 +60,8 @@ diff --git a/web-pages/product-site/tests/test_build.py b/web-pages/product-site/tests/test_build.py index 0d1c2de4a..05b4fffa1 100644 --- a/web-pages/product-site/tests/test_build.py +++ b/web-pages/product-site/tests/test_build.py @@ -1,5 +1,6 @@ from __future__ import annotations +import json import re import sys from pathlib import Path @@ -75,6 +76,25 @@ def test_language_metadata_is_symmetric(tmp_path): assert en.select_one('link[hreflang="zh-CN"]')['href'] == 'https://www.funasr.com/' +def test_visible_repository_links_use_fixed_conversion_routes(tmp_path): + build(tmp_path) + + for relative in ('index.html', 'en/index.html'): + soup = read_soup(tmp_path / relative) + github_links = soup.select('a[aria-label="GitHub"], .final-cta a') + github_hrefs = { + link.get('href') + for link in github_links + if link.get_text(strip=True) == 'GitHub' or link.get('aria-label') == 'GitHub' + } + json_ld = json.loads(soup.select_one('script[type="application/ld+json"]').string) + + assert github_hrefs == {'/go/github'} + assert soup.select_one('.site-footer a[href="/go/docs"]') + assert soup.select_one('.site-footer a[href="/go/releases"]') + assert json_ld['codeRepository'] == 'https://github.com/modelscope/FunASR' + + def test_build_manifest_records_asset_hashes(tmp_path): manifest = build(tmp_path)