Sunday, 13 September 2020

Easy Create Automatic Chapters List on Blogger

Easy Create Automatic Chapters List on Blogger

Easy Create Automatic Chapters List on Blogger
Sunday, 13 September 2020

Creating a chapter list on Blogger is easy but it takes a while to type manually, so the automatic chapter list that I took from the MegumiNovel template created by Codepelajar might be a solution.

This script automatically displays a list of links to posts with a specific label. Suppose the label is Hero, then all link posts and titles with the label Hero will appear in a list. To make it, you have to enter theme edit in html mode, and don't forget to backup the template first. If something untoward happens then you just have to restore it.

Let's go to the tutorial and I assume you have entered the html template edit mode, now look for the code
 <b:includable id='post' var='post'>
Now add the following code right above it
<b:includable id='select_chapter'>
<b:loop values='data:post.labels' var='label'>
<b:if cond=' != &quot;Novel&quot; and != &quot;Anime&quot; and != &quot;Manga&quot;'>
var postID = <>;
if(autlist==true){function autolist(e){for(var t=0;t<e.feed.entry.length;t++){for(var r=0;r<e.feed.entry[t].link.length;r++)if("alternate"==e.feed.entry[t].link[r].rel){var n=e.feed.entry[t].link[r].href;break}var f=e.feed.entry[t].title.$t;e.feed.entry[t].id.$t.substr(51,19)!=postID&&document.write("<li><a href="+n+">"+f+"</a></li>")}}}
<div class='auto-listchap'><ul><script expr:src='&quot;/feeds/posts/default/-/&quot; + + &quot;?orderby=published&amp;max-results=99999&amp;alt=json-in-script&amp;callback=autolist&quot;' type='text/javascript'/></ul></div></b:if></b:loop>

For "Novel, Anime and Manga" is an exception label that will not be executed so the script does not add posts with that label. If you want to add an exception you add the code  and != &quot;Label Name&quot;Then you just add the following code below the code<data:post.body/>
<b:if cond='data:view.isPost'>
<b:include name='select_chapter'/>
Now you save and open the post you want to add a chapter list to automatically, and enter the following code at the bottom of the post. 
<script>var autlist = true</script>

Please create your own style so that the automatic chapter list looks good, if you want the style I have used, please add the following code above the code  ]]></b:skin>or code </style>and of course you have to enter again into html mode.

.auto-listchap {
max-height: 244px;
overflow: auto;
.auto-listchap ul {
padding: 0.1rem;
margin: 0;
.auto-listchap li {
background-color: #eee;
padding: 0.3rem;
margin: 0.3rem;

Now look at the post, if the automatic chapter list script on blogger fails, please ask in the comments column, maybe I can help. And we should be grateful to Codepelajar who made this script.
Easy Create Automatic Chapters List on Blogger
4/ 5