Skip to main content

Blogger Template Formatting: The Secret to Perfect Indentation

Have you been wondering how to make your Blogger XML easy on your eyes and your blood pressure?

I bet you have. But since nobody talks about this (maybe), then I shall talk about this 🫡

PIZZA

5,000+ lines of code is not something to take lightly. We need consistent indentation to clearly see where each tag begins and ends.


This Is An Example

BROKEN INDENTATION

THREE MAGIC STEPS

  1. We select everything on the XML template. Hit:

    CTRL + A
  2. Put some "fake" indentation by pressing

    TAB
  3. Finally, hit:

    SHIFT + TAB
FINAL RESULT

Afterward, we can save that.

This auto indentation feature also works in post edit/create!

Actually, we do not need to make the "fake" indentation, that was just me doing it because I am used to VSCode behavior. Probably even VSCode does not need it 🤔 But that does not matter at the moment.

So then it is just two magical steps:

  1. Select: highlight some parts or select all using CTRL + A.
  2. Tidy it up: SHIFT + TAB

Anyway, for your information, this feature "does not" auto-indent JavaScript or CSS code block, or anything "unparsed" inside <![CDATA[ ]]> (Character Data) section. Well, it does sort of work, but... 🤔 You might want to try that.

We can tidy those parts (JS/CSS) manually in VSCode or other editor, then paste that into Blogger XML.

That is all from me. I hope this tip is useful.

BYE
Last modified on

Comments