forked from fiatjaf/njump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
telegram_instant_view.templ
62 lines (61 loc) · 1.91 KB
/
telegram_instant_view.templ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package main
templ telegramInstantViewTemplate(params TelegramInstantViewParams) {
<meta charset="UTF-8"/>
<!-- check https://nikstar.me/post/instant-view/ for more information on how this was set up -->
<!-- required stuff so telegram treats us like a medium.com article -->
<meta property="al:android:app_name" content="Medium"/>
<meta property="article:published_time" content={ params.CreatedAt }/>
<!-- stuff that goes in the actual telegram message preview -->
<meta property="og:site_name" content={ params.AuthorLong }/>
if params.Description != "" {
<meta property="og:description" content={ params.Description }/>
}
<!---->
if params.Image != "" {
<meta property="og:image" content={ params.Image }/>
}
<!---->
if params.Video != "" {
<meta property="og:video" content={ params.Video }/>
<meta property="og:video:secure_url" content={ params.Video }/>
<meta property="og:video:type" content={ "video/" + params.VideoType }/>
}
<!-- stuff that affects the content inside the preview window -->
<meta name="author" content={ params.Metadata.ShortName() + " on Nostr" }/>
<meta name="telegram:channel" content="@nostr_protocol"/>
<!-- basic content of the preview window -->
<article>
<h1>
if params.Subject != "" {
{ params.Subject }
} else {
<a href={ templ.URL("/" + params.Metadata.Npub()) }>
{ params.Metadata.ShortName() }
</a> on Nostr
if params.ParentNevent != "" {
(reply)
}
:
}
</h1>
if params.ParentNevent != "" {
<aside>
in reply to{ " " }
@templ.Raw(replaceNostrURLsWithHTMLTags(nostrNoteNeventMatcher, "nostr:" + params.ParentNevent))
</aside>
}
<!---->
if params.Summary != "" {
<aside>
@templ.Raw(params.Summary)
</aside>
}
<!---->
@templ.Raw(params.Content)
if params.Subject != "" {
<aside>
<a href={ templ.URL("/" + params.Metadata.Npub()) }>{ params.Metadata.ShortName() }</a>
</aside>
}
</article>
}