abbysmal / Canopy

A git-blogging unikernel written using MirageOS
ISC License
120 stars 27 forks source link

Prettier printing of the HTML header #65

Open gasche opened 7 years ago

gasche commented 7 years ago

Hi there,

I'm now officially a Canopy user thanks to the ICFP'16 blog, and I find it very cool, thanks!

Almost the first thing I did is to look at the HTML source to check that there was a syndication feed available. Unfortunately the (beginning of the) HTML output looks like this:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>ICFP 2016 Liveblog Index</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/bootstrap.min.css"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/canopy.js"></script><link rel="alternate" href="/atom" title="ICFP 2016 Liveblog Index" type="application/atom+xml"/></head><body><nav class="navbar navbar-default"><div class="container"><div class="navbar-header"><button class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a class="navbar-brand" href="/Index">ICFP16</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/CUFP"><span>CUFP</span></a></li><li><a href="/Erlang"><span>Erlang</span></a></li><li><a href="/FARM"><span>FARM</span></a></li><li><a href="/FHPC"><span>FHPC</span></a></li><li><a href="/HIW"><span>HIW</span></a></li><li><a href="/HOPE"><span>HOPE</span></a></li><li><a href="/Haskell"><span>Haskell</span></a></li><li><a href="/ICFP"><span>ICFP</span></a></li><li><a href="/Index"><span>Index</span></a></li><li><a href="/ML"><span>ML</span></a></li><li><a href="/OCaml"><span>OCaml</span></a></li><li><a href="/PLMW"><span>PLMW</span></a></li><li><a href="/Scheme"><span>Scheme</span></a></li><li><a href="/TyDe"><span>TyDe</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>ICFP 2016 Liveblog Index</h2><span class="author">Written by Gemma Gordon, Anil Madhavapeddy, Gabriel Scherer</span><br/><div></div><span class="date">Published: 2016-09-17 (last updated: 2016-10-12)</span><br/><article>

<p>Welcome to the unofficial <a href='http://conf.researchr.org/home/icfp-2016'>ICFP 2016</a>
liveblog!  This is a resource intended to capture the live notes of activity
across the <a href='http://conf.researchr.org/program/icfp-2016/program-icfp-2016'>hundreds of talks</a> that will be given at ICFP 2016 in Nara, Japan.
Any attendee of the conference is welcome to contribute their notes here, and
we will aggregate them after the event into an archive.</p>

As you can see, the newlines are kept in the content, which ends up nicely spaced out and readable, but the header is all on a single line, which makes it difficult to check that there is indeed an Atom feed present.

I think this is not a theoretical issue: some syndication readers just take the blog URL and find the syndication feed themselves, but some users still go find the feed adress by themselves. Would it be possible to pretty-print the header HTML to make the code easier to read?

I checked the source code, of course, and I see a Tyxml.Html.pp call for the whole document, which does not seem to have any obvious "pretty-print" parameter to toggle (cc @Drup?). I don't know of any easy way to fix it, and it may require new features in Ocsigen upstream (or at least the re-implementation of a Tyxml printer inside Canopy), so I understand that it may not end up being fixed in the end.

In that case, I have a workaround suggestion: the index page of the Canopy blog should have a visible link to the syndication feed, either in written text ("syndication feed (Atom)") or as a feed icon, so that people can get the feed URL by copying the link.

feed icon

Drup commented 7 years ago

which does not seem to have any obvious "pretty-print" parameter to toggle

No, but it should be quite easy to add. I would gladly accept any PR adding this.