Friday, January 27, 2023

Super Tech Fun Pak

A COLLECTION OF CODE-BASED HACKS

A cartoon light grey computer with a widescreen and opened browsers with green backgrounds with multiple streaming and social media sites opened, and a number of icons like a laughing emoticon, red heart, magnifying glass, light bulb, speech balloon, and a facebook thumbs up like floating on top.

I avoid giving advice, or solutions, that involve code.

Yet here are some code-based tricks that I use.

The promise of Blogger is a web platform "for the rest of us" that does not require coding knowledge.

True, that promise is not always kept. Especially in the past few years.

But the principle that no user should have to know HTML to blog on Blogger is the correct approach.

Sometimes messing with the code can't be avoided, especially when Blogger breaks something.

And also, I have to come clean. There is some code that I find so useful I use it myself, principles be damned.

I'd be a hypocrite if I did not share.

Alphabetize your posts

There is a script that you can copy and paste into a page or widget to get an alphabetized list of (clickable) blog titles.

The letters 'A' and 'Z' and a red arrow
It revises itself automatically whenever you publish a post.

You know if you need this.

Since the script uses your blog feed, it does not work with private blogs.

I use it on my apple blog to put an alphabetized list of every post labeled "apple review" into my sidebar. 

To do something like that, give a bunch of posts the same label, then, in the code, use the label feed (below) in place of the blog feed.

This is not my script. It is made available, and to some extent maintained, by a fellow named Mark (and was written by his friend, Matt) who uses it on his film blog.

You'll find instructions there.

Label feed: you can modify the script to make a list for any label. Just substitute

/feeds/posts/default/-/[label]

for this in the script

/feeds/posts/summary 

"[label]" is just a stand in for the label, which you must type in. Spaces are "%20".

This is for all the posts with a particular label. The script can put them in order, too.

Google has a blog-feed reference (scroll down to read it) for more options.

Thaw your post previews

Frozen ice sculptures
It's a good idea to preview your posts before publishing. Ironically, you can't check the links or other behaviors in that preview. 

They are, in that sense, unpreviewable

Click on stuff and nothing happens. Your blog is an interactive website, but your previews are frozen images.

Thaw with this simple bit of code:

.blogger-clickTrap {display: none;}

Add it in to your blog using the Customizer that is on your Theme page (click the big orange button). Fumble through the astonishingly bad user interface to find Advanced > CSS.

Then just paste in the code and save. Your preview will act and react like the web page it will become.

Note however that the big freeze is a legitimate security protection and this code bypasses it.

It isn't likely, but if you were persuaded to add a malicious link to your blog post and if you clicked on the link in preview, you would potentially expose your Google account to a bad actor. If the link was designed to take advantage of that.

That's because the preview is on blogger.com, not blogspot.com.

This is a theoretical threat, but let's not fault Google for being cautious. If they left that hole unplugged, someone would try to exploit it.

Restore post quick-edits

Drawing of a pencil
If you have an older blog theme and have lost the incredibly handy quick-edit pencil from your blog posts, Soraya Lambrechts has instructions to get it back.

If you have any blog theme at all, Sam Nordberg has written a bookmarklet (that you put in your browser bar) that acts like quick-edit link, though not as part of your blog.

Soraya's instructions are in French (she is Belgian, Google can translate) under "Comment afficher le crayon de modification des articles sur le blog?" ("How does one show the blog post edit pen?")

Sam's solution is a bookmarklet—code you put in a browser bookmark that runs when you click it. He has full instructions.

Soraya's fix has you crack open the theme xml and rootle about in the code. Google, we should not have to do this! 

Give yourself an extra measure of security and back up your theme before you do anything like that.

I wrote this summary of the quick-edit fiasco.

OK, Google

I understand about protecting us from malicious links, however unlikely.

But how about helping us to blog by restoring the quick-edit option, for everyone, and for widgets too?

And speaking of widgets, a native "list every post in a label A-Z" gadget would be really useful for connecting readers to evergreen content.

We shouldn't have to hack this stuff with scripts and code. It should be available to us in Blogger!

Credit is due

6 comments:

  1. Thanks for the link. And the tip! I had no idea about the feeds/posts/summary version of the feed.

    ReplyDelete
    Replies
    1. @Same: your bookmarklet of special value to those with new blog themes that lack the quick edit entirely. ¶ There are feeds for comments, generally and post-specific, too, among others.

      Delete
  2. Nice list, thanks Adam. I especially like the alphabetic list of posts by label. This is going solve a BIG problem for me!

    ReplyDelete
    Replies
    1. I see you have already put it to good use! This would make such a useful sidebar widget. Google should just make it plug and play.

      Delete
  3. I love blogger because its huge customizability. You can make template from scratch, that's how the way I built my blog design. Love the code you shared!

    ReplyDelete
    Replies
    1. I agree with you, @Binuball. It is a very open platform, which is great!

      But I also think that the basics should be available to even novice users behind a well-designed graphical user interface.

      Delete