SketchUp / sketchup-yard-template

YARD Template used to generate SketchUp Ruby API documentations
MIT License
13 stars 5 forks source link

Forum onebox (asides) do not display favicon because of invalid relative link #23

Open DanRathbun opened 3 years ago

DanRathbun commented 3 years ago

Firstly, the "favicon.ico" file is located at: "https://ruby.sketchup.com/favicon.ico".

In template file: /master/lib/yard-sketchup/templates/default/layout/html/headers.erb ... the shortcut icon ERB HTML is:

    <link rel="shortcut icon" type="image/vnd.microsoft.icon"
    href="<%= url_for('favicon.ico') %>" />

This results in a relative url:

<link rel="shortcut icon" type="image/vnd.microsoft.icon" href="../favicon.ico">

... which works for the API doc page's browser tab, but not when a link to that page is inserted into the forum.

The link in the forum's onebox (aka Discourse aside,) comes out as: "https://ruby.sketchup.com/Sketchup/InstanceObserver.html/../favicon.ico" so the favicon cannot be found and so does not render to the left of the site name. (Interestingly if you insert another "../" in front of the filename, then it's a valid URL.)

The simplest solution is to remove the YARD method call to url_for() and just set an absolute favicon path.