Web Publications via HTML Imports

I've been experimenting a bit with a different approach to creating web
publications.

Our fundamental goal is figuring out how to treat a collection of web
resources as a single entity. It's not hard to create a list of such
resources--EPUB had the package, PWG has been talking about JSON manifests.
But both those things just refer to the resources rather than including
them, and both those things aren't HTML.

And it occured to me that this exact problem was solved twice in the XML
document world, first with external entities and then with xinclude. And
HTML has created just such a feature, in the form of HTML imports*.

A web publication can be represented by a single HTML document that
includes other documents via html imports:

<link rel="import" href="chapter-1.html">
<link rel="import" href="chapter-2.html">

I've made a little example at:

 https://dauwhe.github.io/zero-labs/MobyDickImport/MobyDickImport.html
(see #2 below for why you should view using Chrome).

I see lots of advantages:

1. It's harder to argue about what the URL of the web publication is :)

2. It's easy to provide fallback behavior. If you view the above link in
Chrome, you see the entire copy of the book, as Chrome supports HTML
imports. If you view the link in Safari or Firefox, you see the book table
of contents, so you can still access every resource. And yes, there's a
polyfill for HTML imports.

3. The HTML file containing the imports provides a "canvas" for authors who
wish to supply their own user interface, and also allows reading systems to
just take the links.

4. Nested web publications become easy.
.
5. Resources can be shared between different web publications.

6. The master HTML file is a natural location for publication metadata,
which can be expressed with all the richness and i18n support of HTML (and
can also be embedded as JSON-LD, etc.

7. Web app manifests could still be used to provide save-to-homescreen, etc.


*Yes, HTML imports are controversial, and may evolve into a module system.
Lots of interesting discussions at
https://github.com/w3c/webcomponents/issues/645. Might be fun to talk to
Web Platform WG folks about our use cases. Finally something fun to do on
Friday at TPAC!

Dave

Received on Monday, 24 July 2017 03:32:00 UTC