Preserve the original HTML tags

Making this PR because I had the issue of `media="print"` being stripped from `link` tags.

With this change the original tag is re-used and only the hash part of the path is changed, preserving all extra attributes and formatting like `>` or `/>`.

This refactoring happens to also allow you to use both link and script tags in the same block.