Skip to main content

Code For Index Table Content Automatically

paste this code in post html were u want to add in html  

<details class="k2Toc toc"> <summary data-hide="Hide all" data-show="Show all">Table of Contents</summary> <div class="toc" id="toContent"></div> </details>


paste the down code above </body> 

<b:if cond="data:view.isPost"> <style> html{scroll-behavior:smooth;overflow-x:hidden} details summary{list-style:none;outline:none} details summary::-webkit-details-marker{display:none} details.k2Toc{padding: 10px 15px;background: #f3f3f3;color: black;font-weight: 600;margin: 10px 0px; border:2px solid; border-radius: 5px;box-shadow: rgb(0 0 0 / 15%) 1.95px 1.95px 2.6px;} details.k2Toc summary{display:flex;justify-content:space-between;align-items:baseline} details.k2Toc summary::after{content:attr(data-show);font-size:12px; opacity:.7;cursor:pointer} details.k2Toc[open] summary::after{content:attr(data-hide)} details.toc a:hover{text-decoration: none; color: #fe6c6c;}details.toc a:active{text-decoration: none; color: #fe6c6c;}details.toc a{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden; color:inherit} details.toc ol{list-style:none;padding:0;margin:0; line-height:1.6em; counter-reset:toc-count} details.toc ol ol ol ol{display:none} details.toc ol ol, .tocIn li:not(:last-child){margin-bottom:5px} details.toc li li:first-child{margin-top:5px} details.toc li{display:flex;flex-wrap:wrap; justify-content:flex-end} details.toc li::before{flex:0 0 23px; content:counters(toc-count,'.')'. ';counter-increment:toc-count} details.toc li a{flex:1 0 calc(95% - 23px)} details.toc li li::before{flex:0 0 28px; content:counters(toc-count,'.')} details.toc li li a{flex:1 0 calc(100% - 28px)} details.toc li li li::before{flex:0 0 45px} details.toc li li li a{flex:1 0 calc(100% - 45px)} details.toc .toc >ol{margin-top:1em} details.toc .toc >ol >li >ol{flex:0 0 calc(100% - 23px)} details.toc .toc >ol >li >ol ol{flex:0 0 calc(100% - 45px)} details.toc .toc >ol >li >ol ol ol{flex:0 0 calc(100% - 35px)} </style> <script>/*<![CDATA[*/ /* Table of Contents */ class TableOfContents { constructor({ from, to }) { this.fromElement = from; this.toElement = to; this.headingElements = this.fromElement.querySelectorAll("h1, h2, h3, h4, h5, h6"); this.tocElement = document.createElement("div"); }; getMostImportantHeadingLevel() { let mostImportantHeadingLevel = 6; for (let i = 0; i < this.headingElements.length; i++) { let headingLevel = TableOfContents.getHeadingLevel(this.headingElements[i]); mostImportantHeadingLevel = (headingLevel < mostImportantHeadingLevel) ? headingLevel : mostImportantHeadingLevel; } return mostImportantHeadingLevel; }; static generateId(headingElement) { return headingElement.textContent.replace(/\s+/g, "_"); }; static getHeadingLevel(headingElement) { switch (headingElement.tagName.toLowerCase()) { case "h1": return 1; case "h2": return 2; case "h3": return 3; case "h4": return 4; case "h5": return 5; case "h6": return 6; default: return 1; } }; generateToc() { let currentLevel = this.getMostImportantHeadingLevel() - 1, currentElement = this.tocElement; for (let i = 0; i < this.headingElements.length; i++) { let headingElement = this.headingElements[i], headingLevel = TableOfContents.getHeadingLevel(headingElement), headingLevelDifference = headingLevel - currentLevel, linkElement = document.createElement("a"); if (!headingElement.id) { headingElement.id = TableOfContents.generateId(headingElement); } linkElement.href = `#${headingElement.id}`; linkElement.textContent = headingElement.textContent; if (headingLevelDifference > 0) { for (let j = 0; j < headingLevelDifference; j++) { let listElement = document.createElement("ol"), listItemElement = document.createElement("li"); listElement.appendChild(listItemElement); currentElement.appendChild(listElement); currentElement = listItemElement; } currentElement.appendChild(linkElement); } else { for (let j = 0; j < -headingLevelDifference; j++) { currentElement = currentElement.parentNode.parentNode; } let listItemElement = document.createElement("li"); listItemElement.appendChild(linkElement); currentElement.parentNode.appendChild(listItemElement); currentElement = listItemElement; } currentLevel = headingLevel; } this.toElement.appendChild(this.tocElement.firstChild); } } /*]]>*/</script> <script>document.addEventListener('DOMContentLoaded', () => new TableOfContents({ from: document.querySelector('#post-body'), to: document.querySelector('#toContent') }).generateToc() );</script> </b:if>


agar ye code kaam nahi kar raha hai iska matlab hai ki appko apna div banana hoga html theme me jaye

search  <data:post.body/>

search this code jo last me hoga vo search karna hia


<div class='post-body entry-content float-container' expr:id='&quot;post-body-&quot; + data:post.id'>

    <data:post.body/>


yahan appka data post naam ka id hai appko apna id create karna hoga  div me

just iske uper div id banaye

add blue code 👇

 <div id="Toc01">                  

  <div class='post-body entry-content float-container' expr:id='&quot;post-body-&quot; + data:post.id'>

    <data:post.body/>

  </div>

</div>

        </div>


now change your id in the code u pasted before above  on </body>post-body to Toc01






Comments

Popular posts from this blog

ADD PRICE IN SARA PRODUCT SOLVED

 ₹0.00 bottle 1 ₹0.00art mein ek item hai, jiska naam hai "DISCOVER BEST BRAIN-BOOSTING MULTIVITAMINS: LATEST TOP RESEARCH". Is item ka price ₹0.00 hai, aur isme ek bottle shamil hai. Is item ko aapne ek baar add kiya hai, isliye total price bhi ₹0.00 dikha raha hai.ji per actual me ye product ka price 1200 hia jo ki cart me update nahi ho pa raha hai kaise karu thik se bataye meri bhasha me  mere cart product price add karne ka tarika bataye HTML ME PASTE KARE  <h2 class="premium multivitamins">            </h2>     <div class="mediculabs_product_item_price item_price show"><b>Price:</b><span class="mediculabs_product_price meta-price">65 INR./span&gt;</span></div>

sara remove powered by blogger in footer

💀 no line 8460 <div class='copyright-area'>Created By <a href='http://soratemplates.com/' id='mycontent' rel='dofollow' title='SoraTemplates'>Blogger Theme</a> | Distributed By <a href='https://gooyaabitemplates.com/' rel='dofollow' style='color:#ff00ba;' target='_blank' title='Blogger Templates'>Blogger Templates</a> 💀remove attribute and add html gadget in layout  paste this code there to add ur site logo there <div id="dynamicContent">     <a id="dynamicLink" rel='nofollow'>         <img id="dynamicImage" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdU5mO3u-x3u1kxj0JaU7qzjSZjMB8osCaoPfwGlc2Kx4mjKw3FHkGCjXQs2QZjzujuwZcyPkJABjHi8H8565xjzGFdb5EiwVdRS5LptVvpBdiEHsEIdouU8ALls0t61Kl-FadOnZBN-EUgrS-DZeI-8CYvdpR7TOj0JcZn1guY7RWAHBxOLmtjHaphlYE/s16000-rw/crop%20logo%20image%20side%20bar.png" alt=...

ai tool

 https://smodin.io/free-english-rewriter-and-spinner/ai-detection-remover ai detecter and removal https://originality.ai/blog/highlight-ai-text= for ai highlighter and affiliate marketing https://gptzero.me/  = ai writing detector and highlighter  https://www.zerogpt.com/           = ai content writer detector https://plagiarism-remover.com/humanize-ai-text/           = humanize writer