Re: once more: documentation search indexing

Поиск
Список
Период
Сортировка
От Jonathan S. Katz
Тема Re: once more: documentation search indexing
Дата
Msg-id a8b77aed-7c35-8c83-6450-86c8a70ee670@postgresql.org
обсуждение исходный текст
Ответ на Re: once more: documentation search indexing  (Andres Freund <andres@anarazel.de>)
Ответы Re: once more: documentation search indexing
Список 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


Вложения

В списке pgsql-www по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: once more: documentation search indexing
Следующее
От: Tatsuro Yamada
Дата:
Сообщение: Re: Broken link on the Sponsors page