![]() |
Useful for splitting articles into multiple pages |
Demo Page one
Lorem ipsum dolor sit amet consectetur adipisicing elit. Esse modi sequi qui molestiae provident repellat placeat debitis, nihil odit quisquam molestias cumque exercitationem excepturi temporibus corporis vitae voluptatem? Adipisci, illo.
Guide to creating a split post
- Copy the code from the below code box.
- In the Blogger post editor please change it to HTML View.
- Paste all the copied code into your post.
Example code
<div id="postSplit"> <p>Demo Page one</p> <!--nextpage--> <p>Demo Page two</p> <!--nextpage--> <p>Demo Page three</p> </div> <script> /*<![CDATA[*/ document.addEventListener('DOMContentLoaded', function() {function checkChildren(nodes, elemId){for(i=0;i<nodes.length;i++){if(nodes[i].id==elemId){return nodes[i];}else{return checkChildren(nodes[i].children, elemId);}}} function isNumeric(value) {var type = typeof value; return (type === 'number' || type === 'string') && !Number.isNaN(value - Number.parseFloat(value));} var nodes = document.querySelector('div.postBody').children; var splitdong = checkChildren(nodes, 'postSplit').innerHTML; var content = splitdong.split('<!--nextpage-->'); var url = window.location.href; var url = url.split('?page='); var no = url[1] + '&m=4'; var no = no.split('m'); var no = no[0]; var no = no.replace('&', ''); var url = url[0]; var i = 1; if( !isNumeric(no) ){var no = 1;} document.getElementById('postSplit').innerHTML = content[no-1]; if( content.length > 1 ) {document.getElementById('postSplit').innerHTML += "<div class='postNav' id='postPager'><span class='page current'>Pages :</span></div>";} if( no>1 ){document.getElementById('postPager').innerHTML += "<!-- <a href='"+url+"?page="+(no-1)+"' title='Previous Page'>Prev</a> -->";} content.forEach(function(item) { if( no == i ){document.getElementById('postPager').innerHTML += "<span class='current'>"+i+"</span>";} else {document.getElementById('postPager').innerHTML += "<a href='"+url+"?page="+i+"'>"+i+"</a>";} i++; }); if(content.length > no){ var nn = parseInt(no) + 1; document.getElementById('postPager').innerHTML += "<a href='"+url+"?page="+nn+"'>Next</a>";} }); /*]]>*/ </script>
Note : -
•
•
•
<div id='postSplit'>
- Must exist as main container and all articles must be in this code.•
<!--nextpage-->
- Useful for adding new pages, you can add this tag to split a post into an unlimited number of pages, put each content for the next page just below this tag.
Music_Wallpaper.png
Music
3.05MB
1920×1080
.png