/** * 品牌配置 * 可以通过后端注入或环境变量覆盖 */ (function() { 'use strict'; // 默认配置 var defaultConfig = { officialSite: 'https://goedge.cn', docsSite: 'https://goedge.cn', docsPathPrefix: '/docs', productName: 'GoEdge' }; // 从全局变量获取配置(由后端注入) window.BRAND_CONFIG = { officialSite: window.BRAND_OFFICIAL_SITE || defaultConfig.officialSite, docsSite: window.BRAND_DOCS_SITE || defaultConfig.docsSite, docsPathPrefix: window.BRAND_DOCS_PREFIX || defaultConfig.docsPathPrefix, productName: window.BRAND_PRODUCT_NAME || defaultConfig.productName, /** * 获取文档 URL * @param {string} path - 文档路径,如 "/Appendix/Regexp/Index.md" * @returns {string} 完整的文档 URL */ getDocsURL: function(path) { if (!path) { path = ''; } if (path && path[0] !== '/') { path = '/' + path; } return this.docsSite + this.docsPathPrefix + path; }, /** * 获取官方站点 URL * @param {string} path - 路径 * @returns {string} 完整的官方站点 URL */ getOfficialURL: function(path) { if (!path) { path = ''; } if (path && path[0] !== '/') { path = '/' + path; } return this.officialSite + path; } }; })();