Yeah, a reference to an external file would be a better way to do it. And HTML5 already has the mechanism for this sort of thing: the <link> element[1] and the "rel extensions" registry.
[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/...