fedwiki / wiki-server

Federated Wiki client and server in Node.js
Other
153 stars 35 forks source link

proper title served for .html version #120

Closed WardCunningham closed 8 years ago

WardCunningham commented 8 years ago

This commit adds the proper page title, or slug if no title, to the substitutable template parameters available to wiki-client's static.html.

WardCunningham commented 8 years ago

This pull request needs improvement.

The title parameter is not yet set correctly when rendering the static.html in response to a lineup url. The wiki-client rewrites the title to be the right-most title while browsing. This would be the correct title but might be out of reach for the server since it hasn't yet been fetched from storage and may not even be stored on the origin server.

The behavior as this pull request now stands is to provide the empty string as title for lineup urls. The minimally correct behavior would be to revert to a title of "Federated Wiki" without further server-side analysis.

More could be done server-side. The server could fetch the page in most cases and by examination of the json produce a title consistent with the wiki-client behavior. This is probably a bad idea as it further frustrates serving the federation from static pages. We have previously suggested even parsing a lineup url should be deferred to javascript.

WardCunningham commented 8 years ago

This pull request is again ready to merge.

I've implemented the minimally correct behavior suggested above.

WardCunningham commented 8 years ago

Ok, now slightly better than minimally correct.

In the absence of a proper title, we convert a slug to a title as we have elsewhere in the codebase. Specifically, we replace dashes with space while leaving all alphabetics in lowercase.

paul90 commented 8 years ago

The title parameter is not yet set correctly when rendering the static.html in response to a lineup url

When presented with a lineup url the server does not render any wiki page content - but merely adds enough information to the page sent to the client for it to know what is wanted.

WardCunningham commented 8 years ago

When presented with a lineup url the server does not render any wiki page content

True. And this is how I missed this case. But even without content, a better title tag makes for a better link when a lineup is dropped into chat or social media.

paul90 commented 8 years ago

This fixes the issue reported in #112