Using HTML <base> or links from site root can trim down page size
|Reported by:||jidanni||Owned by:||anonymous|
Gentlemen, I have achieved big savings in the sizes of many pages by
using the same techniques MediaWiki does, mainly not repeating the
whole site name over and over in each link.
Here's the Makefile I used
i=http://abj.jidanni.org j=$i/articles/index.php/ big.html: wget $j -O $@ from_root.html:big.html perl -pwle 's@$i@@g' $? >$@ using_base.html:big.html perl -pwle 's@$j@@g;m@</head>@&&print "<base href=\"$j\" />"' $? >$@ wc:big.html from_root.html using_base.html $@ -lc $?|sed /total$$/d
$ make wc wc -lc big.html from_root.html using_base.html|sed /total$/d 81 8884 big.html 81 7454 from_root.html 82 6339 using_base.html
I would like to especially draw your attention to using_base.html,
though a little bolder than MediaWiki by using <base>, we nonetheless
have lopped off a whole quarter of the bytes of this already diet page
(from my mom's blog, which I created.)
Furthermore, we find we in fact leave the link to the <form> undisturbed,
quelling some worries... Anyway, to actually get these savings, the
core code would need to be enhanced (perhaps allowing using <base> as
an option one can opt-out of), and not of course just running this
I checked in firefox, and even the feed URL works.
Anyway, I hope you'll leave this on the back burner as a long term opimization idea.
You must admit often we have complete grasp of many links and can make this optimization.
If worried about <form>, <meta>, and feed links, they can be left as absolute links.
My Makefile didn't especially put the <base> before all the <meta>s, but you could...
OK, well say theme developers want to use <base>,
but all the common tags probably have no switch one can throw just once somewhere to get them all not to still use absolute URLs.
Well OK, maybe putting a homebrew hook on bloginfo, but still no integrated approch available in the core...
Change History (6)
- Component changed from Optimization to Permalinks
- Resolution set to wontfix
- Status changed from new to closed
- Type changed from enhancement to feature request