Sitemap Page - Plus UI v3.2.0

Khám phá tổng quan có cấu trúc về toàn bộ trang web của chúng tôi với sơ đồ trang web. Trang này liệt kê tất cả các bài đăng và trang, giúp bạn dễ dàng tìm thấy thông tin mình đang tìm kiếm. Cho dù bạn đang khám phá blog của chúng tôi, duyệt nội dung hay điều hướng qua các phần khác nhau, sơ đồ trang web đều đóng vai trò là hướng dẫn hữu ích cho mọi thứ chúng tôi cung cấp.

This documentation is only applicable to v3 (Krishna).

To add sitemap to a page, follow these steps:

  1. In page editor view, click icon at the bottom right of the title.
  2. Two options will appear: HTML view and Writing view.
  3. Select 'HTML View'.
  4. Copy and paste following code.
    <!--[ Begin: Sitemap area ]-->
    <style>
    .sMap >.n, .sCnt > .n{padding:40px 15px;background:var(--contentB);font-size:14px;line-height:1.5rem;text-align:center;border:2px dashed var(--contentL);border-radius:5px}
    .sMap a{color:inherit}
    .sMap a:hover{color:var(--linkC);text-decoration:underline}
    .sMap ol li::marker{opacity:.8}
    @media screen and (min-width: 896px) {
    .sSel{display:flex;gap:12px;margin-bottom:20px}
    .sSel >*{flex:1;margin:0}
    }
    </style>
    <script>
    /*! Plus UI Javascript (sitemap/sitemap.js) | Authors: Deo Kumar, Armaan Kumar (https://fineshopdesign.com) | License: Unlicensed | Copyright (c) 2024 Fineshop Design */
    "use strict";((e,t,l,s,a)=>{let{df:i,lz:n,cEl:r,iAE:o,qSel:d,gId:u,aEL:p,ms:c,mc:g,bg:h,vw:b}=e,v=e=>(e=>new URL(e,l.baseURI))((e=>e.replace(/(^\w+:|^)/,""))(e)),m=l.currentScript,f=r("div",{class:"sMap",innerHTML:`<div class='n'>${c.loading}</div>`});if(!m)return;o(m,"afterend",f);let y=m.getAttribute("data-blog")||h.cnHmU;b.iPrB?f.innerHTML="<div class='n'>Feature Sitemap is not available for Private Blogs.</div>":i.then(()=>n).then(async()=>{let t=new(await e.iBF())(v(y),{jsonp:!0}),[l,i]=await Promise.all([{type:"posts",maxRequests:a.postMaxRequests},{type:"pages",maxRequests:a.pageMaxRequests}].map(async({type:e,maxRequests:l})=>{let s={sortBy:"published",maxResults:150,summary:!0},a=[],i=await t[e].list(s);for(a.push(...i);a.length<150*l&&i.nextUrl;)i=await t[e].list({...s,startIndex:a.length+1}),a.push(...i);return a})),n=[],r={};for(let e=0;e<l.length;e++){let t=l[e];t.published=new Date(t.published),t.updated=new Date(t.updated);let s=t.labels;if(s.length)for(let e=0;e<s.length;e++){let l=s[e];r[l]||(r[l]=[]),r[l].push(t)}else n.push(t)}for(let e=0;e<i.length;e++){let t=i[e];t.published=new Date(t.published),t.updated=new Date(t.updated)}let o={};o.group_all=["All posts",l];for(let e in r)o[`label_${e}`]=[e,r[e]];n.length&&(o.group_unlabelled=[s.uncategorized,n]),o.group_pages=[s.pages,i];let h="";h+="<div class='sSel'><div class='inF'><select id='sm-category'>";for(let e in o)h+=`<option value='${e}'>${o[e][0]}</option>`;h+=`</select><label for='sm-category'>${s.category}</label></div><div class='inF'><select id='sm-sort-by'><option value='published'>${g.published}</option><option value='updated'>${g.updated}</option></select><label for='sm-sort-by'>${s.sortBy}</label></div></div><div class='sCnt'></div>`,f.innerHTML=h;let b=u("sm-category"),m=u("sm-sort-by"),w=d(".sCnt",f),M=()=>{let e=b.value,t=m.value,[l,s]=o[e];if(s.length){s.sort((e,l)=>{if("updated"===t){if(e.updated>l.updated)return-1;if(e.updated<l.updated)return 1}else{if(e.published>l.published)return-1;if(e.published<l.published)return 1}return 0});let e="<ol class='sPls'>";for(let t=0;t<s.length;t++){let l=s[t];e+=`<li><a href='${l.url}' target='_blank'>${l.title}</a></li>`}e+="</ol>",w.innerHTML=e}else w.innerHTML=`<div class='n'>${c.theresNothingHere}</div>`};p(b,"change",M),p(m,"change",M),M()}).catch(t=>{console.warn("Sitemap error:",t),e.iAdm().then(e=>{if(!e)throw new Error("Not admin");f.innerHTML="<div class='n'>Failed to load Sitemap page. Please make sure you are connected to internet and Blog Feed is not set to 'None' in blog settings.</div>"}).catch(()=>{f.innerHTML=`<div class='n'>${g.failedToLoad}</div>`})})})(PU,window,document,{sortBy:"Sort By",allPosts:"All posts",uncategorized:"Uncategorized",pages:"Pages",category:"Category"},{postMaxRequests:4,pageMaxRequests:4});
    </script>
    <!--[ End: Sitemap area ]-->
  5. It is recommended to add a page description paragraph above the given code.
Why is it displaying only 150 posts?

This is because Blogger Feed API is limited to maximum 150 posts in a single request.

Đăng nhận xét