Merge pull request '简化header、title' (#624) from Eeeros/forgeplus-react:gitlink_ssr_test into gitlink_ssr

1
This commit is contained in:
Eeeros 2024-03-16 14:37:41 +08:00
commit 3975838d08
9 changed files with 28 additions and 45 deletions

View File

@ -2,33 +2,24 @@
<html lang="zh-hans-CN" class="notranslate translated-ltr" translate="no">
<head>
<title>GitLink,新一代开源创新服务平台 分布式协作开发 一站式过程管理 高效流水线运维 多层次代码分析 多维度用户画像 分布式协作开发 基于Git打造分布式代码托管环境</title>
<title>GitLink | 新一代开源创新服务平台</title>
<meta charset="utf-8">
<meta name="Keywords" Content="gitLink,GitLink,gitlink,git,trustie,trustieforge,forge,开源,确实开源,代码托管,Git,开源,内源,项目管理,版本控制,开源代码,代码分享,项目协作,开源项目托管,免费代码托管,Git代码托管,Git托管服务,确实让创建更美好,协同开发平台">
<meta name="description" Content="GitLink,新一代开源创新服务平台 分布式协作开发 一站式过程管理 高效流水线运维 多层次代码分析 多维度用户画像 分布式协作开发 基于Git打造分布式代码托管环境">
<meta name="Keywords" content="GitLink, git, 开源, 代码托管, 项目管理, 版本控制, 代码分享, 项目协作, 协同开发平台">
<meta name="description" content="GitLink 是一个新一代的开源创新服务平台,提供分布式协作开发、流水线运维、代码分析等功能,基于 Git 打造分布式代码托管环境。">
<meta property="og:title" content="GitLink | 确实开源" />
<meta property="og:type" content="Object" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://gitlink.org.cn/" />
<meta property="og:image" content="https://www.gitlink.org.cn/images/logo.png" />
<meta property="og:image:alt" content="GitLink | 确实开源" />
<meta property="og:site_name" content="GitLink" />
<meta property="og:description" content="GitLink,新一代开源创新服务平台 分布式协作开发 一站式过程管理 高效流水线运维 多层次代码分析 多维度用户画像 分布式协作开发 基于Git打造分布式代码托管环境" />
<meta property="og:description" content="GitLink 是一个新一代的开源创新服务平台,提供分布式协作开发、流水线运维、代码分析等功能,基于 Git 打造分布式代码托管环境。" />
<meta name="hostname" content="gitlink.org.cn">
<meta name="keyboard-shortcuts-preference" content="all">
<meta name="expected-hostname" content="gitlink.org.cn">
<meta name="go-import" content="gitlink.org.cn git https://gitlink.org.cn">
<meta name="octolytics-dimension-user_login" content="GitLink"></meta>
<meta name="octolytics-dimension-repository_nwo" content="GitLink"></meta>
<meta name="octolytics-dimension-repository_network_root_nwo" content="GitLink"></meta>
<meta name="theme-color" content="#000000">
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> -->
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta name="twitter:image:src" content="https://www.gitlink.org.cn/images/logo.png">
<meta name="twitter:site" content="@gitlink">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="GitLink | 确实开源">
<meta name="twitter:description" content="GitLink,新一代开源创新服务平台 分布式协作开发 一站式过程管理 高效流水线运维 多层次代码分析 多维度用户画像 分布式协作开发 基于Git打造分布式代码托管环境">
<meta content="always" name="referrer">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="referrer" content="always">
<link rel="canonical" href="https://gitlink.org.cn" data-turbo-transient="">
<link rel="fluid-icon" href="https://www.gitlink.org.cn/images/logo.png" title="GitLink">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">

View File

@ -349,31 +349,25 @@ export function addMeta(name, content){
* projectId 项目唯一标识
*/
export function setSeoMeta(keyWords, title, description, url, owner, projectId) {
let keyStatement = ' ';
if(owner)keyStatement += owner;
if(projectId)keyStatement += `/${projectId}`;
if (__SERVER__) {
document = domObj.window.document
}
// 服务端没有location
const host = window.location.host === 'null' || !window.location.host ? ssrHost : window.location.host
const origin = window.location.origin === 'null' || !window.location.origin ? ssrOrigin : window.location.origin
document.querySelector(`meta[property='og:title']`).content = title + keyStatement + ' for gitlink' + keyStatement + ' for git';
document.querySelector(`title`).textContent = title + ' for gitlink';
document.querySelector(`meta[property='og:title']`).content = title + ' | GitLink';
document.querySelector(`title`).textContent = title + ' | GitLink';
document.querySelector(`meta[property='og:url']`).content = origin + url;
document.querySelector(`meta[property='og:description']`).content = description + ' - ' + title + ' for gitlink' + keyStatement + ' for git';
document.querySelector(`meta[property='og:image:alt']`).content = description + ' - ' + title + ' for gitlink' + keyStatement + ' for git';
document.querySelector('meta[name="Keywords"]').content= `${ keyWords } ${ keyWords ? '' : 'gitLink,GitLink,gitlink,trustie,trustieforge,forge,开源,确实开源,代码托管,Git,开源,内源,项目管理,版本控制,开源代码,代码分享,项目协作,开源项目托管,免费代码托管,Git代码托管,Git托管服务,确实让创建更美好,协同开发平台' }` ;
document.querySelector(`meta[name='description']`).content = description + keyStatement + ' for gitlink' + keyStatement + ' for git';
document.querySelector(`meta[property='og:description']`).content = description + ' | GitLink';
document.querySelector(`meta[property='og:image:alt']`).content = description + ' | GitLink';
document.querySelector('meta[name="Keywords"]').content= `${ keyWords },${ keyWords ? '' : 'GitLink, git, 开源, 代码托管, 项目管理, 版本控制, 代码分享, 项目协作, 协同开发平台' }` ;
document.querySelector(`meta[name='description']`).content = description + ' | GitLink';
document.querySelector(`meta[name='go-import']`).content = host + url + ' git ' + origin + url;
document.querySelector(`meta[name='octolytics-dimension-user_login']`).content = owner;
if (projectId) {
document.querySelector(`meta[name='octolytics-dimension-repository_nwo']`).content = owner + '/' + projectId;
document.querySelector(`meta[name='octolytics-dimension-repository_network_root_nwo']`).content = owner + '/' + projectId;
}
document.querySelector(`meta[name='twitter:title']`).content = title + keyStatement + ' for gitlink' + keyStatement + ' for git';
document.querySelector(`meta[name='twitter:description']`).content = description + ' - ' + title + keyStatement + ' for gitlink' + keyStatement + ' for git';
document.querySelector(`link[rel='canonical']`).href = origin + url;
}
@ -382,18 +376,16 @@ export function setDefaultMeta() {
if (__SERVER__) {
document = domObj.window.document
}
document.querySelector(`title`).textContent = 'GitLink,新一代开源创新服务平台 分布式协作开发 一站式过程管理 高效流水线运维 多层次代码分析 多维度用户画像 分布式协作开发 基于Git打造分布式代码托管环境';
document.querySelector(`title`).textContent = 'GitLink | 新一代开源创新服务平台';
document.querySelector(`meta[property='og:title']`).content = 'GitLink | 确实开源';
document.querySelector(`meta[property='og:url']`).content = 'https://gitlink.org.cn/';
document.querySelector(`meta[property='og:description']`).content = 'GitLink,新一代开源创新服务平台 分布式协作开发 一站式过程管理 高效流水线运维 多层次代码分析 多维度用户画像 分布式协作开发 基于Git打造分布式代码托管环境';
document.querySelector(`meta[property='og:url']`).content = 'https://GitLink.org.cn/';
document.querySelector(`meta[property='og:description']`).content = 'GitLink 是一个新一代的开源创新服务平台,提供分布式协作开发、流水线运维、代码分析等功能,基于 Git 打造分布式代码托管环境。';
document.querySelector(`meta[property='og:image:alt']`).content = 'GitLink | 确实开源';
document.querySelector('meta[name="Keywords"]').content= 'gitLink,GitLink,gitlink,git,trustie,trustieforge,forge,开源,确实开源,代码托管,Git,开源,内源,项目管理,版本控制,开源代码,代码分享,项目协作,开源项目托管,免费代码托管,Git代码托管,Git托管服务,确实让创建更美好,协同开发平台';
document.querySelector(`meta[name='description']`).content = 'GitLink,新一代开源创新服务平台 分布式协作开发 一站式过程管理 高效流水线运维 多层次代码分析 多维度用户画像 分布式协作开发 基于Git打造分布式代码托管环境';
document.querySelector(`meta[name='go-import']`).content ='gitlink.org.cn git https://gitlink.org.cn';
document.querySelector('meta[name="Keywords"]').content= 'GitLink, git, 开源, 代码托管, 项目管理, 版本控制, 代码分享, 项目协作, 协同开发平台';
document.querySelector(`meta[name='description']`).content = 'GitLink 是一个新一代的开源创新服务平台,提供分布式协作开发、流水线运维、代码分析等功能,基于 Git 打造分布式代码托管环境。';
document.querySelector(`meta[name='go-import']`).content ='GitLink.org.cn git https://GitLink.org.cn';
document.querySelector(`meta[name='octolytics-dimension-user_login']`).content = 'GitLink';
document.querySelector(`meta[name='octolytics-dimension-repository_nwo']`).content = 'GitLink';
document.querySelector(`meta[name='octolytics-dimension-repository_network_root_nwo']`).content = 'GitLink';
document.querySelector(`meta[name='twitter:title']`).content = 'GitLink | 确实开源';
document.querySelector(`meta[name='twitter:description']`).content = 'GitLink,新一代开源创新服务平台 分布式协作开发 一站式过程管理 高效流水线运维 多层次代码分析 多维度用户画像 分布式协作开发 基于Git打造分布式代码托管环境';
document.querySelector(`link[rel='canonical']`).href = 'https://gitlink.org.cn';
document.querySelector(`link[rel='canonical']`).href = 'https://GitLink.org.cn';
}

View File

@ -29,7 +29,7 @@ function Badge(props) {
} else {
setProjectDetail(result.data);
// seo
let keyWords = `${owner},${projectsId},${result.data.author.name},`;
let keyWords = `${owner},${projectsId},${result.data.author.name}`;
let title = `${owner}/${projectsId}${result.data.description ? '' + result.data.description : ''}`;
setSeoMeta(keyWords, title, result.data.description, `/${owner}/${projectsId}`, owner, projectsId);
}

View File

@ -69,7 +69,7 @@ function NewsDetail(props){
function setMeta(unmount = false) {
if (unmount) {
document.title= zonedetail.name;
setSeoMeta(`${zonedetail.name},`, zonedetail.name, zonedetail.subTitle, `/zone/${deptId}`)
setSeoMeta(`${zonedetail.name}`, zonedetail.name, zonedetail.subTitle, `/zone/${deptId}`)
} else {
const { name, cmsDir, summary, id} = detail;
const title = `${ name }/${ cmsDir.name }`;

View File

@ -34,7 +34,7 @@ function SourceDetail(props){
function componentWillUnmount() {
if (zonedetail) {
document.title= zonedetail.name;
setSeoMeta(`${zonedetail.name},`, zonedetail.name, zonedetail.subTitle, `/zone/${deptId}`)
setSeoMeta(`${zonedetail.name}`, zonedetail.name, zonedetail.subTitle, `/zone/${deptId}`)
}
}

View File

@ -101,7 +101,7 @@ function Index(props){
const {current_user} = props;
if (__SERVER__ && data) {
setSeoMeta(`${data.name},`, data.name, data.subTitle, `/zone/${deptId}`)
setSeoMeta(`${data.name}`, data.name, data.subTitle, `/zone/${deptId}`)
}
useEffect(()=>{
@ -137,7 +137,7 @@ function Index(props){
getAdminUrl(data.id);
getRole(data.id)
}
setSeoMeta(`${data.name},`, data.name, data.subTitle, `/zone/${deptId}`)
setSeoMeta(`${data.name}`, data.name, data.subTitle, `/zone/${deptId}`)
}
}).catch(console.error())
}

View File

@ -428,7 +428,7 @@ class Detail extends Component {
defaultBranch: data.default_branch
});
// seo优化设置
let keyWords=`${owner},${projectsId},${data.author.name},`;
let keyWords=`${owner},${projectsId},${data.author.name}`;
let title= `${owner}/${projectsId}${data.description?''+data.description:''}`;
setSeoMeta(keyWords,title,data.description || '',`/${owner}/${projectsId}`,owner,projectsId);
}

View File

@ -64,7 +64,7 @@ function Detail(props){
axios.get(url).then(result=>{
if(result && result.data){
setDetail(result.data);
let keyWords=`${result.data.nickname},${id},`;
let keyWords=`${result.data.nickname},${id}`;
let title= result.data.nickname+'('+ id +') ' +result.data.description;
setSeoMeta(keyWords,title,title,`/${id}`,id);
}

View File

@ -161,7 +161,7 @@ class Infos extends Component {
const { pathname } = this.props.location;
this.renderPath(pathname,result.data);
document.title = result.data.username ? result.data.username : username;
let keyWords=`${result.data.username},${username},`;
let keyWords=`${result.data.username},${username}`;
let title= result.data.username+'('+ username +')';
setSeoMeta(keyWords,title,title,`/${username}`,username);
})