How to add read more automatically in blogger without javascript - 2023
<b:eval expr='data:post.body snippet {length: 150}'/>
This code displays a specific number of words, in this case the specific value is 150 characters
<b:if cond='data:post.featuredImage'>
<img expr:src='resizeImage(data:post.featuredImage, 100, "16:9")'/>
<b:else/>
<img src='https://cdn.pixabay.com/photo/2023/04/22/10/28/sheep-7943526_640.jpg'/>
</b:if>
This code is a conditional function that checks the existence of the image in the article. If there is an image, you call it with data:post.featuredImage
, and if there is no image, you set a default image<img src="url"/>
<
<
- 1-step:go to dashboard in your blogger > edit html
<data:post.body>
- 2-step:Search for this code
<data:post.body>
- 3-step:replace this code with below code xml:
Counting lines, including html code after a specific line in a text using JavaScript
In this script, we first get the element containing the text using "document.getElementsByClassName()" and store it in a variable called "brl". We then split the text into an array of lines using "split("\n")" and count the number of lines using "length". We divide the result by two to determine where to insert our code.
Next, we define the code we want to inject using "var elem = "<hr>";" and replace the line of text at the specified position with the new content using "brl.innerHTML.replace()". Finally, we update the inner HTML of the element using "brl.innerHTML".
Note that you'll need to modify the JavaScript code to suit your specific needs, such as adjusting the location of the code injection or adding more complex logic.