entry.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. {{ define "title"}}{{ .entry.Title }}{{ end }}
  2. {{ define "content"}}
  3. <section class="entry" data-id="{{ .entry.ID }}">
  4. <header class="entry-header">
  5. <h1 dir="auto">
  6. <a href="{{ .entry.URL | safeURL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .entry.Title }}</a>
  7. </h1>
  8. {{ if .user }}
  9. <div class="entry-actions">
  10. <ul>
  11. <li>
  12. <a href="#"
  13. title="{{ t "entry.status.title" }}"
  14. data-toggle-status="true"
  15. data-label-loading="{{ t "entry.state.saving" }}"
  16. data-label-unread="{{ t "entry.status.unread" }}"
  17. data-label-read="{{ t "entry.status.read" }}"
  18. data-toast-unread="{{ t "entry.status.toast.unread" }}"
  19. data-toast-read="{{ t "entry.status.toast.read" }}"
  20. data-value="{{ if eq .entry.Status "read" }}read{{ else }}unread{{ end }}"
  21. >{{ if eq .entry.Status "unread" }}{{ icon "read" }}{{ else }}{{ icon "unread" }}{{ end }}<span class="icon-label">{{ if eq .entry.Status "unread" }}{{ t "entry.status.read" }}{{ else }}{{ t "entry.status.unread" }}{{ end }}</span></a>
  22. </li>
  23. <li>
  24. <a href="#"
  25. data-toggle-bookmark="true"
  26. data-bookmark-url="{{ route "toggleBookmark" "entryID" .entry.ID }}"
  27. data-label-loading="{{ t "entry.state.saving" }}"
  28. data-label-star="{{ t "entry.bookmark.toggle.on" }}"
  29. data-label-unstar="{{ t "entry.bookmark.toggle.off" }}"
  30. data-toast-star="{{ t "entry.bookmark.toast.on" }}"
  31. data-toast-unstar="{{ t "entry.bookmark.toast.off" }}"
  32. data-value="{{ if .entry.Starred }}star{{ else }}unstar{{ end }}"
  33. >{{ if .entry.Starred }}{{ icon "unstar" }}{{ else }}{{ icon "star" }}{{ end }}<span class="icon-label">{{ if .entry.Starred }}{{ t "entry.bookmark.toggle.off" }}{{ else }}{{ t "entry.bookmark.toggle.on" }}{{ end }}</span></a>
  34. </li>
  35. {{ if .hasSaveEntry }}
  36. <li>
  37. <a href="#"
  38. title="{{ t "entry.save.title" }}"
  39. data-save-entry="true"
  40. data-save-url="{{ route "saveEntry" "entryID" .entry.ID }}"
  41. data-label-loading="{{ t "entry.state.saving" }}"
  42. data-label-done="{{ t "entry.save.completed" }}"
  43. data-toast-done="{{ t "entry.save.toast.completed" }}"
  44. >{{ icon "save" }}<span class="icon-label">{{ t "entry.save.label" }}</span></a>
  45. </li>
  46. {{ end }}
  47. {{ if .entry.ShareCode }}
  48. <li>
  49. <a href="{{ route "sharedEntry" "shareCode" .entry.ShareCode }}"
  50. title="{{ t "entry.shared_entry.title" }}"
  51. target="_blank">{{ icon "share" }}<span class="icon-label">{{ t "entry.shared_entry.label" }}</span></a>
  52. </li>
  53. <li>
  54. <a href="#"
  55. data-confirm="true"
  56. data-url="{{ route "unshareEntry" "entryID" .entry.ID }}"
  57. data-label-question="{{ t "confirm.question" }}"
  58. data-label-yes="{{ t "confirm.yes" }}"
  59. data-label-no="{{ t "confirm.no" }}"
  60. data-label-loading="{{ t "confirm.loading" }}">{{ icon "delete" }}<span class="icon-label">{{ t "entry.unshare.label" }}</span></a>
  61. </li>
  62. {{ else }}
  63. <li>
  64. <a href="{{ route "shareEntry" "entryID" .entry.ID }}"
  65. title="{{ t "entry.share.title" }}"
  66. target="_blank">{{ icon "share" }}<span class="icon-label">{{ t "entry.share.label" }}</span></a>
  67. </li>
  68. {{ end }}
  69. <li>
  70. <a href="{{ .entry.URL | safeURL }}"
  71. target="_blank"
  72. rel="noopener noreferrer"
  73. referrerpolicy="no-referrer"
  74. data-original-link="true">{{ icon "external-link" }}<span class="icon-label">{{ t "entry.external_link.label" }}</span></a>
  75. </li>
  76. <li>
  77. <a href="#"
  78. title="{{ t "entry.scraper.title" }}"
  79. data-fetch-content-entry="true"
  80. data-fetch-content-url="{{ route "fetchContent" "entryID" .entry.ID }}"
  81. data-label-loading="{{ t "entry.state.loading" }}"
  82. >{{ icon "scraper" }}<span class="icon-label">{{ t "entry.scraper.label" }}</span></a>
  83. </li>
  84. {{ if .entry.CommentsURL }}
  85. <li>
  86. <a href="{{ .entry.CommentsURL | safeURL }}"
  87. title="{{ t "entry.comments.title" }}"
  88. target="_blank"
  89. rel="noopener noreferrer"
  90. referrerpolicy="no-referrer"
  91. data-comments-link="true"
  92. >{{ icon "comment" }}<span class="icon-label">{{ t "entry.comments.label" }}</span></a>
  93. </li>
  94. {{ end }}
  95. </ul>
  96. </div>
  97. {{ end }}
  98. <div class="entry-meta" dir="auto">
  99. <span class="entry-website">
  100. {{ if and .user (ne .entry.Feed.Icon.IconID 0) }}
  101. <img src="{{ route "icon" "iconID" .entry.Feed.Icon.IconID }}" width="16" height="16" loading="lazy" alt="{{ .entry.Feed.Title }}">
  102. {{ end }}
  103. {{ if .user }}
  104. <a href="{{ route "feedEntries" "feedID" .entry.Feed.ID }}">{{ .entry.Feed.Title }}</a>
  105. {{ else }}
  106. <a href="{{ .entry.Feed.SiteURL | safeURL }}">{{ .entry.Feed.Title }}</a>
  107. {{ end }}
  108. </span>
  109. {{ if .entry.Author }}
  110. <span class="entry-author">
  111. {{ if isEmail .entry.Author }}
  112. - <a href="mailto:{{ .entry.Author }}">{{ .entry.Author }}</a>
  113. {{ else }}
  114. – <em>{{ .entry.Author }}</em>
  115. {{ end }}
  116. </span>
  117. {{ end }}
  118. {{ if .user }}
  119. <span class="category">
  120. <a href="{{ route "categoryEntries" "categoryID" .entry.Feed.Category.ID }}">{{ .entry.Feed.Category.Title }}</a>
  121. </span>
  122. {{ end }}
  123. </div>
  124. <div class="entry-date">
  125. {{ if .user }}
  126. <time datetime="{{ isodate .entry.Date }}" title="{{ isodate .entry.Date }}">{{ elapsed $.user.Timezone .entry.Date }}</time>
  127. {{ else }}
  128. <time datetime="{{ isodate .entry.Date }}" title="{{ isodate .entry.Date }}">{{ elapsed "UTC" .entry.Date }}</time>
  129. {{ end }}
  130. {{ if and .user.ShowReadingTime (gt .entry.ReadingTime 0) }}
  131. &centerdot;
  132. <span>
  133. {{ plural "entry.estimated_reading_time" .entry.ReadingTime .entry.ReadingTime }}
  134. </span>
  135. {{ end }}
  136. </div>
  137. </header>
  138. {{ if gt (len .entry.Content) 120 }}
  139. {{ if .user }}
  140. <div class="pagination-entry-top">
  141. {{ template "entry_pagination" . }}
  142. </div>
  143. {{ end }}
  144. {{ end }}
  145. <article role="article" class="entry-content" dir="auto">
  146. {{ if .user }}
  147. {{ noescape (proxyFilter .entry.Content) }}
  148. {{ else }}
  149. {{ noescape .entry.Content }}
  150. {{ end }}
  151. </article>
  152. {{ if .entry.Enclosures }}
  153. <details class="entry-enclosures">
  154. <summary>{{ t "page.entry.attachments" }} ({{ len .entry.Enclosures }})</summary>
  155. {{ range .entry.Enclosures }}
  156. {{ if ne .URL "" }}
  157. <div class="entry-enclosure">
  158. {{ if hasPrefix .MimeType "audio/" }}
  159. <div class="enclosure-audio">
  160. <audio controls preload="metadata">
  161. <source src="{{ .URL | safeURL }}" type="{{ .MimeType }}">
  162. </audio>
  163. </div>
  164. {{ else if hasPrefix .MimeType "video/" }}
  165. <div class="enclosure-video">
  166. <video controls preload="metadata">
  167. <source src="{{ .URL | safeURL }}" type="{{ .MimeType }}">
  168. </video>
  169. </div>
  170. {{ else if hasPrefix .MimeType "image/" }}
  171. <div class="enclosure-image">
  172. {{ if $.user }}
  173. <img src="{{ proxyURL .URL }}" title="{{ .URL }} ({{ .MimeType }})" loading="lazy" alt="{{ .URL }} ({{ .MimeType }})">
  174. {{ else }}
  175. <img src="{{ .URL | safeURL }}" title="{{ .URL }} ({{ .MimeType }})" loading="lazy" alt="{{ .URL }} ({{ .MimeType }})">
  176. {{ end }}
  177. </div>
  178. {{ end }}
  179. <div class="entry-enclosure-download">
  180. <a href="{{ .URL | safeURL }}" title="{{ t "action.download" }}{{ if gt .Size 0 }} - {{ formatFileSize .Size }}{{ end }} ({{ .MimeType }})" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .URL | safeURL }}</a>
  181. <small>{{ if gt .Size 0 }} - <strong>{{ formatFileSize .Size }}</strong>{{ end }}</small>
  182. </div>
  183. </div>
  184. {{ end }}
  185. {{ end }}
  186. </details>
  187. {{ end }}
  188. </section>
  189. {{ if .user }}
  190. <div class="pagination-entry-bottom">
  191. {{ template "entry_pagination" . }}
  192. </div>
  193. {{ end }}
  194. {{ end }}