[wp-trac] [WordPress Trac] #9286: Using HTML <base> or links from
site root can trim down page size
WordPress Trac
wp-trac at lists.automattic.com
Fri Mar 6 00:12:02 GMT 2009
#9286: Using HTML <base> or links from site root can trim down page size
--------------------------+-------------------------------------------------
Reporter: jidanni | Owner: anonymous
Type: enhancement | Status: new
Priority: lowest | Milestone:
Component: Optimization | Version: 2.7.1
Severity: trivial | Keywords:
--------------------------+-------------------------------------------------
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.
http://www.w3.org/TR/html401/struct/links.html#h-12.4
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
}}}
which gives
{{{
$ 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
Makefile.
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...
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9286>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list