Comments (13)
By removing that part from the footer, site generation goes from 48 => 24 seconds. Files also get half the size.
from hugo-theme-docdock.
I see Hugo has wonderful builtin function which could be as wide improvement to minify rendered HTML across all themes. No external build tools then required.
https://gohugo.io/templates/introduction/#whitespace
from hugo-theme-docdock.
@GeertvanHorrik can you try this e371ac0?
from hugo-theme-docdock.
Doesn't seem to work. It's the spaces in front of the code that are the culprit:
from hugo-theme-docdock.
Yes, those spaces I "compressed". I did changes only inside <div id="navigation">..</div>
. So many spaces should come from one of loops (range).
- You sure my commit is in effect for local copy you try?
- Maybe you have this file override outside theme directory?
- Restart Hugo, live-preview can fail update template files (if you use live-preview).
- Look for errors when starting local Hugo server.
and... - Can you locate from where exactly in
.html
layout those extra whitespaces come from?
from hugo-theme-docdock.
Using this seems to fix it:
<div id="navigation">
<!-- Next prev page -->
{{with ($.Scratch.Get "prevPage")}}<a class="nav nav-prev" href="{{.URL}}" title="{{.Title}}"> <i class="fa fa-chevron-left"></i></a>{{end}}
{{with ($.Scratch.Get "nextPage")}}<a class="nav nav-next" href="{{.URL}}" title="{{.Title}}" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>{{end}}
</div>
from hugo-theme-docdock.
@GeertvanHorrik please check-out this compress-html-whitespace and check result
from hugo-theme-docdock.
I think it's the spaces in front of the template codes that are the issue. Your fixes don't seem to fully solve the issue:
from hugo-theme-docdock.
After some more tests, it already looks a lot cleaner and files have gone from 700kb => 360kb.
from hugo-theme-docdock.
As a final experiment, I've opened the menu.html partial in notepad++, select all, shift + tab until there is no more indentation. Now the file is 320kb, which is a lot better.
from hugo-theme-docdock.
Those blank lines in #61 (comment) are from template lines, which has Hugo template code, but does not produce any actual output.
Removing whitespace before <a>
tag would only remove from that line. It can't produce that amount of blank lines, and also have different indentation. Here all lines <li>
, <a ...
and </li>
have same indent space.
Removing all, all, all odd spaces (minifying it) in template is not practical as it makes code and HTML hard to read. To do that for production level use tools for this purpose. I.e. something automated like Grunt or even SaaS like Netlify.
from hugo-theme-docdock.
@GeertvanHorrik I suggest this to be closed.
from hugo-theme-docdock.
Fully agree, thanks for fixing!
from hugo-theme-docdock.
Related Issues (20)
- big issue in theme demo, subtopics jump around in menu HOT 2
- [Add-Customization][Docs] Expand each main content upon click and display sub content without show page under main content HOT 1
- [Issue] Sidebar long title content line spacing take same as for between two different contents
- Flex Theme Top Bar Affect to Link Tags Navigation
- instructions for modifying/building scss?
- text after alert shortcode does no render markdown properties HOT 3
- Title Line-Spacing Insufficient HOT 2
- Extra "s" in aside menu entry titles HOT 3
- Flex Theme title of article(tag) is shown in the title HOT 1
- notice shortcode does not display the title HOT 1
- how to disable copy-to-clipboard
- [short codes]: Children Anchorlink not working HOT 1
- "attachments" shortcode broken under Hugo 0.73.0 HOT 11
- tags broken
- using theme HOT 1
- RevealJS Tables font style issues
- [Question] Gobal RevealJS height and width options
- How to not display title in the page
- How to define dropdown menu in menu.shortcuts section?
- How to remove "last update" and "improve this page" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hugo-theme-docdock.