修改seo函数

This commit is contained in:
何童崇 2023-01-13 17:27:31 +08:00
commit aeaac4e933
6 changed files with 45 additions and 13 deletions

View File

@ -47,6 +47,7 @@
<script src="https://gw.alipayobjects.com/os/lib/react-dom/16.14.0/umd/react-dom.%REACT_URL%.js"></script>
<script src="%PUBLIC_URL%js/jquery-1.8.3.min.js"></script>
<script src="%PUBLIC_URL%js/js_min_all.js"></script>
<script src="%PUBLIC_URL%js/common.js"></script>
<script src="%PUBLIC_URL%js/codemirror/codemirror.js"></script>
<script src="%PUBLIC_URL%js/editormd/editormd.min.js"></script>
<script src="%PUBLIC_URL%js/codemirror/merge/merge.js"></script>
@ -60,12 +61,19 @@
hm.src = "https://hm.baidu.com/hm.js?7e2def1fe918f15f9f1c5c061f69b256";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
function aaa(){
console.log(111);
window.onload=function(){
$(".newContainer").delegate("a.anchors","click",function(){
let h = $(this).offset().top - 180;
console.log($(this).offset().top,document.body.scrollTop);
$("html,body").animate({scrollTop:h},10);
window.location.hash = $(this).attr("name");
return false;
});
}
</script>
</script>
</body>
</html>

View File

@ -323,13 +323,13 @@ export function addMeta(name, content){
export function setSeoMeta(keyWords, title, description, url, owner, projectId) {
console.log('keyWords:'+ keyWords);
document.querySelector(`meta[property='og:title']`).content = title;
document.querySelector(`meta[property='og:url']`).content = location.origin + url;
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[name="Keywords"]').content=keyWords + 'gitLink,GitLink,gitlink,trustie,trustieforge,forge,开源,确实开源,代码托管,Git,开源,内源,项目管理,版本控制,开源代码,代码分享,项目协作,开源项目托管,免费代码托管,Git代码托管,Git托管服务,确实让创建更美好,协同开发平台';
document.querySelector(`meta[name='description']`).content = description;
document.querySelector(`meta[name='go-import']`).content = location.host + url + ' git ' + location.origin + url;
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;
@ -338,6 +338,6 @@ export function setSeoMeta(keyWords, title, description, url, owner, projectId)
document.querySelector(`meta[name='twitter:title']`).content = title;
document.querySelector(`meta[name='twitter:description']`).content = description + ' - ' + title;
document.querySelector(`link[rel='canonical']`).href = location.origin + url;
document.querySelector(`link[rel='canonical']`).href = window.location.origin + url;
}

View File

@ -23,6 +23,7 @@ function indentCodeCompensation(raw, text) {
.join('\n');
}
//兼容之前的 ##标题式写法
let toc = []
let ctx = ["<ul>"]
@ -117,6 +118,7 @@ function replace_math_with_ids(text) {
return rs
}
const original_listitem = renderer.listitem
renderer.listitem = function (text, task, checked) {
return original_listitem(replace_math_with_ids(text), task, checked)
@ -155,7 +157,8 @@ renderer.heading = function (text, level, raw) {
level: level,
text: text
})
return '<h' + level + ' id="' + anchor + '" class="markdown_anchors"><a href="#'+anchor+'" class="anchors"><i class="iconfont icon-lianjieicon font-14"></i></a>' + text + '</h' + level + '>'
let id = anchor.replace(/[.,/#!$%^&*;:{}=\-_`~():,。¥;「」|?》《~·【】‘、!]/g,"");
return '<h' + level + ' id="' + id + '" class="markdown_anchors"><a name="#'+id+'" class="anchors"><i class="iconfont icon-lianjieicon font-14"></i></a>' + text + '</h' + level + '>'
}
marked.setOptions({
silent: true,

View File

@ -56,7 +56,7 @@ export default ({
let id = decodeURIComponent(u.split("#")[1]);
let ele = document.getElementById(id);
if(ele){
window.scrollTo(0, ele.offsetTop + 120);
window.scrollTo(0, ele.offsetTop);
}
}
}

View File

@ -124,8 +124,29 @@ export default ((props) => {
</AlignCenterBetween>
<div className="g-desc">{group.description ? group.description : "暂无描述"}</div>
<div className="g-tip">
<p>组织的Owner团队拥有更改组织设置在组织内新建仓库新建组织团队等权限</p>
<p>此外Owner团队成员对当前组织下所有项目均具有仓库管理员权限组织下其他团队的权限可由Owner团队成员自由制定</p>
{
group.authorize === "owner"?
<div>
<p>管理员团队对 <span>所有仓库</span> 具有操作权限且对组织具有 <span>管理员权限</span></p>
<p>此外该团队拥有了 <span>创建仓库</span> 的权限成员可以在组织中创建新的仓库</p>
</div>
:
group.authorize === "admin" ?
<div>
<p>该团队拥有<span> 管理 所有仓库</span>的权限团队成员可以读取克隆推送以及添加其它仓库协作者</p>
<p>此外该团队拥有了 <span>创建仓库</span> 的权限成员可以在组织中创建新的仓库</p>
</div>
:
group.authorize === "write" ?
<div>
<p>该团队拥有对所属仓库的 <span>读取</span> <span>写入</span> 的权限</p>
</div>
:
<div>
<p>此团队授予 <span>读取所有仓库</span> 的访问权限成员可以查看和克隆仓库</p>
</div>
}
{group.is_admin ? <Button type="primary" onClick={()=>props.history.push(`/${OIdentifier}/teams/${groupId}/setting`)}><span className="color-white">团队设置</span></Button> : ""}
</div>
</div>

View File

@ -291,10 +291,10 @@
color:#888;
padding:28px 20px;
border-top: 1px solid #eee;
&>p{
&>div>p{
margin-bottom: 10px!important;
}
&>p>span{
&>div>p>span{
color:#333;
}
&>button{