Force partial to respect tabbing

This is a pretty insignificant desire, but is there any way to force a partial’s contents to respect the tab formatting of where it’s found?


    {{ partial "_schema" . }}


    <meta property="og:locale:alternate" content="ja" />
    <meta property="og:locale:alternate" content="zh" />
    <meta property="og:locale:alternate" content="ko" />
    <meta property="og:locale:alternate" content="de" />
    <meta property="og:locale:alternate" content="fr" />
    <meta property="og:locale:alternate" content="es" />
    <meta property="og:locale:alternate" content="da" />
    <meta property="og:locale:alternate" content="it" />
    <meta property="og:locale:alternate" content="pt" />
    <meta property="og:locale:alternate" content="sv" />

Currently it outputs the same tabbing as found in the partial file.

Other than using {{- partial "foo" -}} to remove leading and/or trailing whitespace, no.

It would be nice when viewing source I suppose, but if you view source with your browser’s dev tools the source is formatted for you.

And since you’re always going to minify in production, I’m not sure this is worth any effort.

1 Like

Yeah, pretty small potatoes, but it mattered just enough to ask. :slight_smile: Thanks again!

If it matters that much then use a script like code-beautifier - npm in a separate process on the public folder to beautify all changed files. Hugo has a --renderToDisk parameter that you can use with hugo server to write all files to the hard drive.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.