hugo-toha / toha

A Hugo theme for personal portfolio
https://hugo-toha.github.io
MIT License
1.03k stars 586 forks source link

Huge amount of whitelines in generated html files #922

Closed dietervansteenwegen closed 6 months ago

dietervansteenwegen commented 6 months ago

If I look at the generated html files for my site, I find (for example):

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>HP 8640B Part 2: Mains input and rectifier board replacement</title>
    <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />

<link rel="stylesheet" href="/application.329a340bbaf43ee282aa1d1e756d60440b8483a27c895d03dec3cb4d8c51e73d.css" integrity="sha256-Mpo0C7r0PuKCqh0edW1gRAuEg6J8iV0D3sPLTYxR5z0=" />

  <link rel="icon" type="image/png" href="/images/logo_hu03100fbc35296c522ace3dd4201c056d_25145_42x0_resize_box_3.png" />

<meta property="og:title" content="HP 8640B Part 2: Mains input and rectifier board replacement" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://boxfish.be/posts/20240206-hp-8640b-2-mains-input-and-rectifier-board-replacement/" /><meta property="article:section" content="posts" />
<meta property="article:published_time" content="2024-02-06T21:12:29+01:00" />
<meta property="article:modified_time" content="2024-02-06T21:12:29+01:00" />

    <meta name="twitter:card" content="summary"/><meta name="twitter:title" content="HP 8640B Part 2: Mains input and rectifier board replacement"/>
<meta name="twitter:description" content="Introduction 6 years ago I acquired an HP 8640B that needed work (see HP 8640B Part 1: initial state).>    

<meta name="description" content="HP 8640B Part 2: Mains input and rectifier board replacement" />

This is just part of the <head> section. Notice the large amount of whitelines. A bit further down that same html file, I found 63 consecutive whitelines, none of which came from the content/MarkDown files.

I looked at /layout/partials/head.html as a start. As a test, I replaced many of the {{ xxxxxx }} tags (is this correct terminology?) with {{- xxxxxxxxx -}} to strip whitespace and removed all empty lines.

Building my site with these changes greatly reduced the amount of empty lines in the relevant section of my html file.

So I have a couple of questions:

Thanks!

dietervansteenwegen commented 6 months ago

... Unless you use --minify when building the site.

:facepalm:

I guess that is the way most people do it and why no one is bothered by the empty lines.