~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[RFC PATCH] Add forge and VCS meta tags

Details
Message ID
<20211123141233.6802-1-me@adnano.co>
DKIM signature
pass
Download raw message
Patch: +11 -0
See https://sr.ht/~ancarda/vcs-autodiscovery/

References: https://todo.sr.ht/~sircmpwn/git.sr.ht/163
---
Eventually we'll probably want to remove the go-source meta tag. We'll
likely need to keep the go-import meta tag around for a while.

 gitsrht/templates/repo.html | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gitsrht/templates/repo.html b/gitsrht/templates/repo.html
index 0db0f0c..52762b6 100644
--- a/gitsrht/templates/repo.html
+++ b/gitsrht/templates/repo.html
@@ -3,6 +3,17 @@
{% if repo.visibility.value =='unlisted' %}
<meta name="robots" content="noindex">
{% endif %}
<meta name="vcs" content="git">
{% for clone_url in (repo | clone_urls) %}
<meta name="vcs:clone" content="{{clone_url}}">
{% endfor %}
{% set project_url = (repo | clone_urls)[0] %}
<meta name="forge:summary" content="{{project_url}}">
<meta name="forge:dir" content="{{project_url}}/tree/{ref}/item/{path}">
<meta name="forge:file" content="{{project_url}}/tree/{ref}/item/{path}">
<meta name="forge:rawfile" content="{{project_url}}/blob/{ref}/{path}">
<meta name="forge:line" content="{{project_url}}/tree/{ref}/item/{path}#L{line}">

{# Man, this is lame #}
<meta name="go-import"
  content="{{domain}}/{{owner.canonical_name}}/{{repo.name}} git {{(repo | clone_urls)[0]}}">
-- 
2.32.0
Details
Message ID
<CFXV1Z1BGVRQ.1VMA6KNMXDG0V@taiga>
In-Reply-To
<20211123141233.6802-1-me@adnano.co> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
On Tue Nov 23, 2021 at 3:12 PM CET, Adnan Maolood wrote:
> --- a/gitsrht/templates/repo.html
> +++ b/gitsrht/templates/repo.html
> @@ -3,6 +3,17 @@
> {% if repo.visibility.value =='unlisted' %}
> <meta name="robots" content="noindex">
> {% endif %}
> +<meta name="vcs" content="git">
> +{% for clone_url in (repo | clone_urls) %}
> +<meta name="vcs:clone" content="{{clone_url}}">
> +{% endfor %}

Given this from the spec:

> The unauthorized URI SHOULD be first.

The clone_urls filter should have a comment added first which describes
this constraint so that future changes to it don't break the spec.

> +{% set project_url = (repo | clone_urls)[0] %}

This should use url_for("repo.summary") instead (I think it's
repo.summary? Double check).
Details
Message ID
<CFYL83MHUM13.AY4JJJQDSTTY@nitro>
In-Reply-To
<CFXV1Z1BGVRQ.1VMA6KNMXDG0V@taiga> (view parent)
DKIM signature
pass
Download raw message
On Wed Nov 24, 2021 at 3:18 AM EST, Drew DeVault wrote:
> The clone_urls filter should have a comment added first which describes
> this constraint so that future changes to it don't break the spec.

Alright, I'll add a note.

> > +{% set project_url = (repo | clone_urls)[0] %}
>
> This should use url_for("repo.summary") instead (I think it's
> repo.summary? Double check).

It looks like url_for returns a relative URL, when we need the URL to
have the scheme and authority. Is there a way to get an absolute URL?
Details
Message ID
<CFYPXBC8VAVW.3DBZT367C6P0V@taiga>
In-Reply-To
<CFYL83MHUM13.AY4JJJQDSTTY@nitro> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
On Thu Nov 25, 2021 at 5:48 AM CET, Adnan Maolood wrote:
> > This should use url_for("repo.summary") instead (I think it's
> > repo.summary? Double check).
>
> It looks like url_for returns a relative URL, when we need the URL to
> have the scheme and authority. Is there a way to get an absolute URL?

Yeah, {{root}} should always be available in all templates iirc.
Reply to thread Export thread (mbox)