seo优化调整

This commit is contained in:
何童崇 2023-02-07 15:24:37 +08:00
parent ad86e65ac9
commit d532912f06
3 changed files with 15 additions and 10 deletions

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="Keywords" Content="gitLink,GitLink,gitlink,trustie,trustieforge,forge,开源,确实开源,代码托管,Git,开源,内源,项目管理,版本控制,开源代码,代码分享,项目协作,开源项目托管,免费代码托管,Git代码托管,Git托管服务,确实让创建更美好,协同开发平台">
<meta name="Keywords" Content="gitLink,GitLink,gitlink,git,trustie,trustieforge,forge,开源,确实开源,代码托管,Git,开源,内源,项目管理,版本控制,开源代码,代码分享,项目协作,开源项目托管,免费代码托管,Git代码托管,Git托管服务,确实让创建更美好,协同开发平台">
<meta name="description" Content="GitLink,新一代开源创新服务平台 分布式协作开发 一站式过程管理 高效流水线运维 多层次代码分析 多维度用户画像 分布式协作开发 基于Git打造分布式代码托管环境">
<meta property="og:title" content="GitLink | 确实开源" />
<meta property="og:type" content="Object" />
@ -17,6 +17,8 @@
<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">

View File

@ -321,22 +321,25 @@ export function addMeta(name, content){
* projectId 项目唯一标识
*/
export function setSeoMeta(keyWords, title, description, url, owner, projectId) {
console.log('keyWords:'+ keyWords);
document.querySelector(`meta[property='og:title']`).content = title;
let keyStatement = ' ';
if(owner)keyStatement += owner;
if(projectId)keyStatement += `/${projectId}`;
document.querySelector(`meta[property='og:title']`).content = title + keyStatement + ' for gitlink' + keyStatement + ' for git';
document.querySelector(`meta[property='og:url']`).content = window.location.origin + url;
document.querySelector(`meta[property='og:description']`).content = description + ' - ' + title;
document.querySelector(`meta[property='og:image:alt']`).content = description + ' - ' + title;
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 + 'gitLink,GitLink,gitlink,trustie,trustieforge,forge,开源,确实开源,代码托管,Git,开源,内源,项目管理,版本控制,开源代码,代码分享,项目协作,开源项目托管,免费代码托管,Git代码托管,Git托管服务,确实让创建更美好,协同开发平台';
document.querySelector(`meta[name='description']`).content = description;
document.querySelector(`meta[name='description']`).content = description + keyStatement + ' for gitlink' + keyStatement + ' for git';
document.querySelector(`meta[name='go-import']`).content = window.location.host + url + ' git ' + window.location.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;
document.querySelector(`meta[name='twitter:description']`).content = description + ' - ' + title;
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 = window.location.origin + url;

View File

@ -107,9 +107,9 @@ function CoderDepot(props){
const { author, name, description, default_branch} = details;
if(branchName && branchName !== default_branch){
// /
document.title = `${author.name}/${name}-${branchName}`;
document.title = `${author.name}/${name}-${branchName}-for gitlink;for git`;
}else{
document.title = `${author.name}/${name}${description?': '+description:''}`;
document.title = `${author.name}/${name}${description?': '+description:''}-for gitlink;for git` ;
}
}
}, [treeValuePath, details, branchName])