meta精简

This commit is contained in:
黄心宇 2024-03-15 16:24:12 +08:00
parent 8eb5b2d562
commit 12bf33f8e4
2 changed files with 19 additions and 31 deletions

View File

@ -2,32 +2,24 @@
<html lang="zh-hans-CN" class="notranslate translated-ltr" translate="no">
<head>
<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

@ -344,25 +344,21 @@ 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}`;
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 + ' 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[name='go-import']`).content = window.location.host + url + ' git ' + window.location.origin + url;
// 服务端没有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 + ' | GitLink';
document.querySelector(`title`).textContent = title + ' | GitLink';
document.querySelector(`meta[property='og:url']`).content = origin + url;
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 = window.location.origin + url;
document.querySelector(`link[rel='canonical']`).href = origin + url;
}