Add pagesize calculator #10

Open
opened 2026-08-28 14:12:24 +02:00 by gribse · 0 comments
Owner

I am currently using a script from Zuma to calculate page dl size at load.
This is javascrit which could be omitted, and depends on cached media of the user's browser.

By baking the size in each page before publication it would be even lighter and reliable.

Todo :

  • pre-build the site

  • for each html page

    • parse evey file *.html ?
    • or get a list of pages ? can hugo make it ?
  • generate a list of filesizes for each webpage and store it in a csv

    • example : https://github.com/chbricout/hugo-sizer/
    • what size to take into account ?
      • filesizes of folder : total size, but not what the browser downlods
      • data called by browser : wont count full size images
        • this is the best option : spin up a headless browser without caching, and count how much was loaded ?
  • at build, get the data from the csv and put it in the footer, for each page.

    • replace a tag in html files
  • time this operation and print rex data : time to run, number of pages checked, nb of pages updated, site total size

Optional :

  • to save on calculation time, the size calculator would only run on updated pages, aka pages whose content folder has a change on git, since the last time this calculation ran.
    • csv has a column with the commit the calculation ran on for each page.
    • if the commit is different, run the calculation again and update the commit.
      • for every file in the content folder, check last commit.
I am currently using a script from Zuma to calculate page dl size at load. This is javascrit which could be omitted, and depends on cached media of the user's browser. By baking the size in each page before publication it would be even lighter and reliable. Todo : - [ ] pre-build the site - [ ] for each html page - parse evey file *.html ? - or get a list of pages ? can hugo make it ? - [ ] generate a list of filesizes for each webpage and store it in a csv - example : https://github.com/chbricout/hugo-sizer/ - what size to take into account ? - filesizes of folder : total size, but not what the browser downlods - data called by browser : wont count full size images - this is the best option : spin up a headless browser without caching, and count how much was loaded ? - [ ] at build, get the data from the csv and put it in the footer, for each page. - replace a tag in html files - [ ] time this operation and print rex data : time to run, number of pages checked, nb of pages updated, site total size Optional : - [ ] to save on calculation time, the size calculator would only run on updated pages, aka pages whose content folder has a change on git, since the last time this calculation ran. - csv has a column with the commit the calculation ran on for each page. - if the commit is different, run the calculation again and update the commit. - for every file in the content folder, check last commit.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gribse/merl1-cms#10
No description provided.