{"id":9767,"date":"2023-07-05T10:51:47","date_gmt":"2023-07-05T08:51:47","guid":{"rendered":"https:\/\/www.main-vision.com\/richard\/blog\/?p=9767"},"modified":"2023-07-05T10:52:07","modified_gmt":"2023-07-05T08:52:07","slug":"how-to-audit-hugo-html","status":"publish","type":"post","link":"https:\/\/www.main-vision.com\/richard\/blog\/how-to-audit-hugo-html\/","title":{"rendered":"How to Audit Hugo HTML"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>\n<p>With Hugo you can generate entire websites within milliseconds if they&#8217;re small and seconds if they&#8217;re large. Within a very short amount of time thousands of pages are generated. If you went through and checked each page then this could take hours, or even weeks, depending on the size of the site. To save time Hugo does have a command to check for html in Markdown in seconds. The next step is to see the title of the markdown pages with an issue and fix them individually.<\/p>\n\n\n\n<p>You can run an html audit on Hugo by running the command: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo &amp;&amp; grep -inorE \"&lt;\\!-- raw HTML omitted -->|ZgotmplZ|\\&#91;i18n\\]|\\(&lt;nil>\\)|(&amp;lt;nil&amp;gt;)|hahahugo\" public\/ . <\/code><\/pre>\n\n\n\n<p>It will go through your website and check that all html is working properly.<\/p>\n\n\n\n<p><strong>When to Use It<\/strong><\/p>\n\n\n\n<p>The best time to run an audit is when you have imported a wordpress blog to md, or from some other source to markdown. Markdown recognises some HTML but not all. I found that it is especially at comments that markdown was confused. It saw the time and date tags and detected an error. It also generates errors when it comes across html tags. If you want to display code with md you need to use back example code for the code to be ignored. \\ Does not work in markdown.<\/p>\n\n\n\n<p><strong>How it Helps<\/strong><\/p>\n\n\n\n<p>Auditing Hugo before building helps to detect flaws that are not visible unless you check the source code for each page individually. With this simple solution you can check the entire website when you build. The first time you run it you will find errors, but over time those errors will increase. In the tutorial they say that you will run it once to check, and a second time for the official build. I ran it more often than that. The errors I got were intuitive to fix. Look for html code in markdown and you&#8217;ll find the problems. Markdown does not like smileys so if comments are converted to markdown, you need to remove the smileys.<\/p>\n\n\n\n<p>The <a href=\"https:\/\/discourse.gohugo.io\/t\/audit-your-published-site-for-problems\/35184\">article<\/a> is here if you want to learn more.<\/p>\n\n\n\n<p><strong>And Finally<\/strong><\/p>\n\n\n\n<p>If you want to learn more about Hugo you can read the <a href=\"https:\/\/discourse.gohugo.io\/t\/hugo-tutorials-tips\/39009\">tutorials<\/a> pages. I also use <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=DavidAnson.vscode-markdownlint\">markdownlint<\/a> in Visual Studio for help with checking markdown and ensuring that it is correct.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>With Hugo you can generate entire websites within milliseconds if they&#8217;re small and seconds if they&#8217;re large. Within a very short amount of time thousands of pages are generated. If you went through and checked each page then this could take hours, or even weeks, depending on the size of the site. To save time [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9474,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[5256,5257,5197],"class_list":["post-9767","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech-related","tag-audit","tag-html","tag-hugo"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/posts\/9767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/comments?post=9767"}],"version-history":[{"count":1,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/posts\/9767\/revisions"}],"predecessor-version":[{"id":9768,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/posts\/9767\/revisions\/9768"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/media\/9474"}],"wp:attachment":[{"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/media?parent=9767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/categories?post=9767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/tags?post=9767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}