Content Negotiation

Problem to solve

As a user of pages I request a page from <username>.gitlab.io/page I expect it to return "content-type: text/html" and the file "page.html". Furthermore, if I change the request to add the header "Accept: application/rdf+xml", I expect it to return "content-type: application/rdf+xml" and the file "page.rdf", provided "page.rdf" exists. Otherwise it should fall back to the "text/html" behaviour. This should be implemented for all the semantic web mime-types: turtle, n3, json-ld, owl and rdf.

Target audience

Semantic Web users, both machine and human.

Further details

This also has applications for returning pages in the users language, but I'm no expert on other applications of content-negotiation.

Content-negotiation is the recommended standard for delivering semantic web content.

You'll be ahead of other static hosting platforms who cannot provide this service.

It'll also provide pretty urls: <username>.gitlab.io/page without the .html

Proposal

I have insufficient knowledge of how Pages work to know how to solve this.

What does success look like, and how can we measure that?

Requests with different Accept headers deliver the appropriate content-type if available, falls back to html otherwise.

Implementation Guide:

It is yet to test what is possible. The content type is fetched here.

These test files can be used to investigate this further:

  1. https://gitlab.com/gitlab-org/gitlab-pages/-/blob/master/internal/vfs/serving/serving_test.go
  2. https://gitlab.com/gitlab-org/gitlab-pages/-/blob/master/internal/serving/disk/zip/serving_test.go

~"feature proposal"

Edited by Naman Jagdish Gala