diff --git a/templates/tag.html b/templates/tag.html index 5856db9..41b9d91 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -56,7 +56,7 @@ h1 a:not([href]){color:inherit;text-decoration:none;vertical-align: bottom;font- {% endblock %} {% block content %} -
{{ blogBase['subTitle'] }}
+
{% endblock %} @@ -68,6 +68,8 @@ document.getElementById("pathRSS").setAttribute("d",IconList["rss"]); document.getElementById("{{ blogBase['singeListJson'][num]['postTitle'] }}").setAttribute("d",value=IconList["{{ blogBase['singeListJson'][num]['label'] }}"]); {%- endfor %} +tag=window.location.hash.slice(1); +tagList=[]; let requestJson="blogBase.json" let request=new XMLHttpRequest(); request.open("GET",requestJson); @@ -79,12 +81,21 @@ request.onload=function(){ showList(jsonData); } -tag=window.location.hash.slice(1) - function showList(jsonData){ let SideNav=document.getElementsByClassName("SideNav")[0]; + let tagLable=document.getElementById("tagLable"); for(i in jsonData["postListJson"]){ + if(!(jsonData["postListJson"][i]['label'] in tagList)){ + tagList.push(jsonData["postListJson"][i]['label']); + let showLabels=document.createElement("span"); + showLabels.setAttribute("class","Label"); + showLabels.setAttribute("style","background-color:"+jsonData["postListJson"][i]['labelColor']); + showLabels.innerHTML=jsonData["postListJson"][i]['label']; + showLabels.setAttribute("href",'#'+jsonData["postListJson"][i]['label']); + tagLable.appendChild(showLabels); + } + if(jsonData["postListJson"][i]['label']==tag || tag==''){ let item=document.createElement("a"); item.setAttribute("class","SideNav-item d-flex flex-items-center flex-justify-between");