Pages

Friday, 21 April 2023

How to find and replace in a blogger post

My blog was created on the venerable Google platform of Blogger. No problem with that, but the world has moved on in the past twenty years, and some things have always been a bit "you can't get there from here"... although ardent Blogger fans have often created code to help those less able users to do most things we need to do. But there is one small thing that I keep returning to: how to do a find and replace within a blog post.

You see, the blank spaces at the end of a paragraph in html code is often replaced with the " " character, or non-breaking space. This is usually a very handy trick that we use between elements which we don't want to line-break on, such as $5: we would enter this as "$ 5" to ensure that this all stayed together. However, when this non-breaking line space happens automatically at a paragraph end, the word wrapping often happens on the previous word, leaving line orphans in odd places.

Also, at the beginning of a post, if my first paragraph is too short, in my 30 word blog roll summary it looks like I have made a mistake and not left a trailing space after a full stop. So I at least want my first paragraph or two to have paragraph end trailing spaces.

So I tend to get rid of the auto-magically created " "s, or at least code them out as I go. I can do a "find" - easy peasy - simply Ctrl & F when in html blogger view, and I get a wee box at the top of the page that I can enter my find item into. However, "find and replace" function is not an easy find. Thanks to chiliNUT (2021) I can Ctrl, Shift & F, and I get a box for the replacement text (in the same place as the find box), then I need to hit enter to get the second box in the same place, where I can enter my replacement text. Note that if you are using this that there are not TWO boxes: one for find, and one for replace. This is a single box, activated by a keyboard 'Enter'.

There is an option to copy the html out into Notepad or Word, edit there, and return it, but this is a bit of a fag to do. I use the Shift & Ctrl & F option mostly, but in the past I used Notepad a lot (chiliNUT, 2021).

However, there is a third way to replace ALL the code or text in your Blogger blog. I have used this for broken links, and to harmonise phrasing or keywords in the past. Created by Adam Lewis, we go to his site here, and REALLY, REALLY think carefully through the consequences of doing a replace all, because we cannot easily undo it. I would recommend backing up the site content and design before doing this just in case there are unexpected outcomes!

I hope this helps someone :-D


Sam

References:

chiliNUT. (10 May 2021). How to find all and replace all on blogspot html editor?. StackOverflow. https://stackoverflow.com/questions/67465638/how-to-find-all-and-replace-all-on-blogspot-html-editor

Lewis, A. W. (2012). Blogger Find & Replace. https://www.adamwlewis.com/articles/blogger-find-replace?happy=1

No comments :

Post a Comment

Thanks for your feedback. The elves will post it shortly.