Re: once more: documentation search indexing

From: "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Michael Christofides <michael(at)pgmustard(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL WWW <pgsql-www(at)lists(dot)postgresql(dot)org>
Subject: Re: once more: documentation search indexing
Date: 2022-03-18 02:20:20
Message-ID: a8b77aed-7c35-8c83-6450-86c8a70ee670@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

On 3/17/22 3:15 PM, Andres Freund wrote:

>> diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
>> index c2d00c8..162776f 100644
>> --- a/pgweb/docs/views.py
>> +++ b/pgweb/docs/views.py
>> @@ -120,11 +120,30 @@ def docpage(request, version, filename):
>> else:
>> contentpreview = ''
>>
>> + # determine the canonical version of the page
>> + # if the doc page is in the current version, then we set it to current
>> + # otherwise, check the supported and unsupported versions and find the
>> + # last version that the page appeared
>> + # we exclude "devel" as development docs are disallowed in robots.txt
>
> Not related to this, but I think we should change this at some point. It's
> nice to be able to find a documentation page for a new tool.

This is indeed a whole separate thread ;)

>> diff --git a/templates/docs/docspage.html b/templates/docs/docspage.html
>> index f5f3e3b..7a4e2fc 100644
>> --- a/templates/docs/docspage.html
>> +++ b/templates/docs/docspage.html
>> @@ -27,6 +27,9 @@
>> {%endif%}
>> <link rel="stylesheet" type="text/css" href="/dyncss/base.css?{{gitrev}}">
>> {%block extrahead%}{%endblock%}
>> + {% if canonical_version %}
>> + <link rel="canonical" href="https://www.postgresql.org/docs/{{ canonical_version }}/{{ ver.file }}" />
>> + {% endif %}
>> </head>
>
> What's the reason to put this after extrahead, rather than before?

No reason, but according to this article from 2013[1], it should be
further up in <head>. I'll adjust.

When testing, I also noticed I had a wrong reference there for
generating the page title; this version fixes it.

>> diff --git a/templates/docs/index.html b/templates/docs/index.html
>> index cfcc2f8..63e4559 100644
>> --- a/templates/docs/index.html
>> +++ b/templates/docs/index.html
>> @@ -27,6 +27,9 @@
>> <tr>
>> <td>
>> <a href="/docs/{{v.numtree}}/index.html">{{v.treestring}}</a>
>> + {% if v.current %}
>> + (<a href="/docs/current/index.html">Current</a>)
>> + {% endif %}
>> </td>
>> <td>
>> {%if v.a4pdf or v.uspdf%}
>
> So this is just going to a separate link for the html docs, not the pdf
> docs. Which do not seem to be available under a 'current' style link anyway? I
> guess that's good enough for now...

Ugh this patch had some dust. I think that may have been part of the
proposal to either a) have more links to "current" on the docs index
page and/or b) make it clear which version is "current" in the list.

> Perhaps some non-link visual separation between e.g. "14" and "current" would
> make sense? Even just a " / " might help. Otherwise it might not be obvious
> that they're different link targets.

...I'd even be OK with removing it, but it's also one of those things
that's easy enough to change, so trying that out.

Attached another version.

Jonathan

[1]
https://developers.google.com/search/blog/2013/04/5-common-mistakes-with-relcanonical#mistake-5:-rel=canonical-in-the-body

Attachment Content-Type Size
0001-Add-canonical-page-references-to-documentation.patch text/plain 3.5 KB

In response to

Responses

Browse pgsql-www by date

  From Date Subject
Next Message Tatsuro Yamada 2022-03-18 07:27:03 Re: Broken link on the Sponsors page
Previous Message Andres Freund 2022-03-17 19:15:09 Re: once more: documentation search indexing