forked from
microcosm.blue/microcosm-rs
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
1{% extends "base.html.j2" %}
2{% import "try-it-macros.html.j2" as try_it %}
3
4{% block title %}Backlinks{% endblock %}
5{% block description %}All {{ query.source }} records with links to {{ query.subject }}{% endblock %}
6
7{% block content %}
8
9 {% call try_it::get_backlinks(query.subject, query.source, query.did, query.limit) %}
10
11 <h2>
12 Links to <code>{{ query.subject }}</code>
13 {% if let Some(browseable_uri) = query.subject|to_browseable %}
14 <small style="font-weight: normal; font-size: 1rem"><a href="{{ browseable_uri }}">browse record</a></small>
15 {% endif %}
16 </h2>
17
18 <p><strong>{{ total|human_number }} links</strong> from <code>{{ query.source }}</code>.</p>
19
20 <ul>
21 <li>See distinct linking DIDs at <code>/links/distinct-dids</code>: <a href="/links/distinct-dids?target={{ query.subject|urlencode }}&collection={{ collection|urlencode }}&path={{ path|urlencode }}">/links/distinct-dids?target={{ query.subject }}&collection={{ collection }}&path={{ path }}</a></li>
22 <li>See all links to this target at <code>/links/all</code>: <a href="/links/all?target={{ query.subject|urlencode }}">/links/all?target={{ query.subject }}</a></li>
23 </ul>
24
25 <h3>Links, most recent first:</h3>
26
27 {% for record in records %}
28 <pre style="display: block; margin: 1em 2em" class="code"><strong>DID</strong>: {{ record.did().0 }} (<a href="/links/all?target={{ record.did().0|urlencode }}">DID links</a>)
29<strong>Collection</strong>: {{ record.collection }}
30<strong>RKey</strong>: {{ record.rkey }}
31-> <a href="https://pdsls.dev/at://{{ record.did().0 }}/{{ record.collection }}/{{ record.rkey }}">browse record</a></pre>
32 {% endfor %}
33
34 {% if let Some(c) = cursor %}
35 <form method="get" action="/xrpc/blue.microcosm.links.getBacklinks">
36 <input type="hidden" name="subject" value="{{ query.subject }}" />
37 <input type="hidden" name="source" value="{{ query.source }}" />
38 <input type="hidden" name="limit" value="{{ query.limit }}" />
39 {% for did in query.did %}
40 <input type="hidden" name="did" value="{{ did }}" />
41 {% endfor %}
42 <input type="hidden" name="cursor" value={{ c|json|safe }} />
43 <button type="submit">next page…</button>
44 </form>
45 {% else %}
46 <button disabled><em>end of results</em></button>
47 {% endif %}
48
49 <details>
50 <summary>Raw JSON response</summary>
51 <pre class="code">{{ self|tojson }}</pre>
52 </details>
53
54{% endblock %}