Table of contents or sitemap is one of the important elements in a blog / web. Like a book, a blog must also have a table of contents as a place of information for visitors to the blog that lists the titles of articles that have been published, so that visitors can easily find the information needed.
In addition, according to SEO experts, creating a blog sitemap is also one form of SEO, because in the sitemap it contains a very complex arrangement of links and automatically strengthens the link building of a blog.
Why is it called an automatic table of contents? Because each post that you publish will automatically be saved / listed on the blog's contents page. So we don't need to write it manually, Practical boss.
Here is how to create a table of contents / sitemap automatically on a blog using a script that can be said to be very light or Responsive, because this simple table of contents is loaded does not use help from outside links.
Speaking of Responsive questions, has your Blogger template been responsive, if you haven't followed this guide:
List simple contents without labels
1. Enter Blogger >> select blog >> click the Page menu >> click the new page.
Give the page a table of contents , a Sitemap , or a Sitemap .
2.
Klik mode HTML
(next to compose), Copy and paste one of the script codes below.
If you want the table of contents to only display the title of the post, please use the following script.
<script>
var numposts = 1000;
</script>
<script>
function boss(json) {
document.write('<ul>');
for (var i = 0; i < numposts; i++) {
document.write('<li>');
var entry = json.feed.entry[i];
var posttitle = entry.title.$t;
var posturl;
if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
posturl = entry.link[k].href;
posttitle = posttitle.link(posturl);
}
}
document.write(posttitle);
('</li>');
}
('</ul>');
}
</script>
<script src="https://howtoblogacademy.blogspot.com/atom.xml?redirect=false&start-index=1&max-results=1000&orderby=published&alt=json-in-script&callback=boss"></script>
If you want the table of contents to display the title and date of the post, please use the script below.
<script>
var numposts = 1000;
var showpostdate = true;
</script>
<script>
function boss(json) {
document.write('<ul>');
for (var i = 0; i < numposts; i++) {
document.write('<li>');
var entry = json.feed.entry[i];
var posttitle = entry.title.$t;
var posturl;
if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
posturl = entry.link[k].href;
posttitle = posttitle.link(posturl);
var postdate = entry.published.$t;
var cdyear = postdate.substring(0,4);
var cdmonth = postdate.substring(5,7);
var cdday = postdate.substring(8,10);
var monthnames = new Array();
monthnames[1] = "Jan";
monthnames[2] = "Feb";
monthnames[3] = "Mar";
monthnames[4] = "Apr";
monthnames[5] = "May";
monthnames[6] = "Jun";
monthnames[7] = "Jul";
monthnames[8] = "Aug";
monthnames[9] = "Sep";
monthnames[10] = "Oct";
monthnames[11] = "Nov";
monthnames[12] = "Dec";
}
}
document.write(posttitle);
if (showpostdate == true) document.write(' ' + cdday + ' - ' + monthnames[parseInt(cdmonth,10)] + ' - ' + cdyear);
('</li>');
}
('</ul>');
}
</script>
<script src="https://howtoblogacademy.blogspot.com//atom.xml?redirect=false&start-index=1&max-results=1000&orderby=published&alt=json-in-script&callback=boss"></script>
Don't forget to change the red color with the address of your blog.
ket:
var numposts = 1000;
This means that the table of contents can contain a maximum of 1000 article titles, please change as needed.
var showpostdate = true;
This shows the current date display, if the value is changed to
false
, then the posting date does not appear (disabled).
Based on personal experience We recommend that the sitemap page be published immediately
mode HTML
, because if it is published in the mode compose
script it can't function anymore because there is a change in position in the script. (yellow script is easy to change).
3. Publish
If a warning appears like this:
This page contains HTTP resources that can cause mixed content to affect security and user experience if the blog is viewed via HTTPS.
Click fix, then publish.
4. See the results, and write down
sitemap
your address , then you just have to install it on your blog menu.
Note: If you use a title
Sitemap
, it will usually produce an address like this:http://yoursite.blogspot.com/p/sitemap.html
Learn also: How to Create a Blog Contents by Label .
So many tutorials on how to make a simple sitemap on a blog, hopefully it can be useful and good luck. Regards, Blogger.
0 Comments:
Post a Comment