Home Work For Largest Contentful Paint element Skip to main content

Work For Largest Contentful Paint element

Async loading aur preload rules


search script snippet-item r-snippetized under <div class

paste this code just below it



HTML
&lt;!-- Async loading of scripts --&gt;
  &lt;script async src=&quot;your-script.js&quot;&gt;&lt;/script&gt;

  &lt;!-- Preload rule for resources --&gt;
  &lt;link rel=&quot;preload&quot; href=&quot;your-resource.css&quot; as=&quot;style&quot; /&gt;
&lt;/div&gt;

 2. lazy load

paste this code just above </body> in the theme html



HTML2
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;UTF-8&quot;&gt;
  &lt;title&gt;Lazy Loading Images&lt;/title&gt;
  &lt;style&gt;
    /* Some basic styling for demonstration */
    .image-container {
      width: 300px;
      height: 200px;
      border: 1px solid #ccc;
      margin: 10px;
    }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

  &lt;!-- Your content before lazy loading images --&gt;

  &lt;div class=&quot;image-container&quot;&gt;
    &lt;img class=&quot;lazy&quot; data-src=&quot;path_to_your_image.jpg&quot; alt=&quot;Lazy Loaded Image&quot;&gt;
  &lt;/div&gt;

  &lt;!-- Other images using similar structure --&gt;

  &lt;script&gt;
    document.addEventListener(&quot;DOMContentLoaded&quot;, function() {
      let lazyImages = document.querySelectorAll(&#39;.lazy&#39;);

      let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
        entries.forEach(function(entry) {
          if (entry.isIntersecting) {
            let lazyImage = entry.target;
            lazyImage.src = lazyImage.dataset.src; // Load the image by setting the src attribute
            lazyImage.classList.remove(&#39;lazy&#39;); // Remove the class to prevent re-loading on subsequent intersections
            lazyImageObserver.unobserve(lazyImage); // Stop observing this image
          }
        });
      });

      lazyImages.forEach(function(lazyImage) {
        lazyImageObserver.observe(lazyImage);
      });
    });
  &lt;/script&gt;

  &lt;!-- Your content after lazy loading images --&gt;

&lt;/body&gt;
&lt;/html&gt;


Add code for AJAX 

paste this code just above the </body> tag in html theme


Ajax
<!-- Place this code in the <head> tag or right before the closing </body> tag -->
<script defer src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

preload and Async rule for title featured popular and blog post

paste this code just above the </body> tag in html theme

HTML4
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;UTF-8&quot;&gt;
  &lt;title&gt;Dynamic Content Example&lt;/title&gt;
  &lt;style&gt;
    /* Basic styling for demonstration */
    .featured {
      font-weight: bold;
      color: blue;
    }
    .popular {
      color: green;
    }
    .blog-post {
      color: black;
    }
  &lt;/style&gt;
  &lt;!-- Preloading styles --&gt;
  &lt;link rel=&quot;preload&quot; href=&quot;styles.css&quot; as=&quot;style&quot;&gt;

  &lt;!-- Async loading of script --&gt;
  &lt;script async src=&quot;your-script.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;h1 id=&quot;page-title&quot;&gt;Title&lt;/h1&gt;
  &lt;div class=&quot;featured&quot; id=&quot;featured-post&quot;&gt;Featured Post&lt;/div&gt;
  &lt;div class=&quot;popular&quot; id=&quot;popular-post&quot;&gt;Popular Post&lt;/div&gt;
  &lt;div class=&quot;blog-post&quot; id=&quot;blog-post&quot;&gt;Blog Post&lt;/div&gt;

  &lt;script&gt;
    // Replace these placeholders with your actual content
    document.addEventListener(&#39;DOMContentLoaded&#39;, function() {
      document.getElementById(&#39;page-title&#39;).innerText = &#39;My Blog&#39;;
      document.getElementById(&#39;featured-post&#39;).innerText = &#39;Featured: Post 1&#39;;
      document.getElementById(&#39;popular-post&#39;).innerText = &#39;Popular: Post 2&#39;;
      document.getElementById(&#39;blog-post&#39;).innerText = &#39;Recent Blog: Post 3&#39;;
    });
  &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;



add this👇 yellow code just below the        <div class='snippet-item r-snippetized'>

HTML5

 <b:includable id='userProfileText'>

          <dd class='profile-textblock profile-snippet snippet-container r-snippet-container'>

            <div class='snippet-item r-snippetized'>

              <div class='snippet-item r-snippetized'>

  &lt;!-- Async loading of scripts --&gt;

  &lt;script async src=&quot;your-script.js&quot;&gt;&lt;/script&gt;

  &lt;!-- Preload rule for resources --&gt;

  &lt;link rel=&quot;preload&quot; href=&quot;your-resource.css&quot; as=&quot;style&quot; /&gt;

&lt;/div&gt;

            <data:aboutme/>

            </div>

            <div class='snippet-fade r-snippet-fade show'/>


searching script big-post-text important you that to change it only in css style section code 👇{body section
Replace👇 code for big-post-text to make it responsive 
HTML6
.heroPost .big-post-text{
background-color:$(heropost.secondary.background.color);
box-sizing:border-box;
color:$(heropost.secondary.text.color);
-webkit-box-flex:1;
-webkit-flex:1 1 auto;
-ms-flex:1 1 auto;
flex:1 1 auto;
min-width:0;
padding:48px
}
replace upper☝ code with👇 down code
HTML7
/* Default styles for big-post-text */
.heroPost .big-post-text {
  background-color: $(heropost.secondary.background.color);
  box-sizing: border-box;
  color: $(heropost.secondary.text.color);
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 0;
  padding: 48px;
}
/* Default styles for big-post-text */
.heroPost .big-post-text {
  /* Existing styles */
  display: flex; /* Changing display property to flex */
  align-items: center; /* Centering content vertically */
  white-space: nowrap; /* Preventing text from wrapping */
}

/* Targeting text within big-post-text for horizontal display */
.heroPost .big-post-text p,
.heroPost .big-post-text span,
.heroPost .big-post-text h1,
.heroPost .big-post-text h2,
.heroPost .big-post-text h3,
.heroPost .big-post-text h4,
.heroPost .big-post-text h5,
.heroPost .big-post-text h6 {
  display: inline; /* Making text inline */
}

/* Media query for responsiveness */
@media screen and (max-width: 600px) {
  .heroPost .big-post-text {
    /* Adjustments for smaller screens */
    padding: 24px; /* Adjusted padding for smaller screens */
    /* Any other styles for smaller screens */
 } 

problem will be solved 

#1.
site title is in horizontal but site text content shows vertical

paste the below code in html theme just belw 

body{
overflow-wrap:break-word;
word-break:break-word;
word-wrap:break-word
}
HTML8
.tab-title {
  writing-mode: horizontal-tb; /* Title ko horizontal layout mein display karega */
}


#
post me image or media nahi hote hai to ye mere content ko display karte hai as media display karte ahi and phir container me text fit nahi hota hia content ka kyoki ye responsive nahi hai isko solve karne ke liye kya kiya jana chahiye






HTML9
<p>This is a simple HTML code</p>

searching script <div class='post-content container'>




paste this down code in between the upper shown lines 3034 down the <div class='post-content-container'
 
This will make ur div class lazy load rule
 
HTML10
&lt;div class=&#39;post-content container&#39;&gt;
  &lt;!-- WebP Image --&gt;
  &lt;img src=&quot;image.webp&quot; alt=&quot;WebP Image&quot; loading=&quot;lazy&quot; type=&quot;image/webp&quot;&gt;
  
  &lt;!-- JPEG Image --&gt;
  &lt;img src=&quot;image.jpg&quot; alt=&quot;JPEG Image&quot; loading=&quot;lazy&quot; type=&quot;image/jpeg&quot;&gt;
  
  &lt;!-- PNG Image --&gt;
  &lt;img src=&quot;image.png&quot; alt=&quot;PNG Image&quot; loading=&quot;lazy&quot; type=&quot;image/png&quot;&gt;
  
  &lt;!-- GIF Image --&gt;
  &lt;img src=&quot;image.gif&quot; alt=&quot;GIF Image&quot; loading=&quot;lazy&quot; type=&quot;image/gif&quot;&gt;
&lt;/div&gt;

bala
HTML11
<p>This is a simple HTML code</p>
tala
HTML12
<p>This is a simple HTML code</p>
sala
HTML13
<p>This is a simple HTML code</p>
kala
HTML14
<p>This is a simple HTML code</p>
halla
HTML15
<p>This is a simple HTML code</p>

Comments

Lazy Loading Example Preloaded Image Another Preloaded Image