c68d52a33313810d581029eb2fabf456429a4a54
3 const th
= require('./template-helper');
5 function aboutSection() {
6 return ` <section class="about">
9 This is a <a class="external" href="https://www.w3.org/TR/websub/">WebSub</a> Hub service.
12 It facilitates the timely distribution of new content from publishers to subscribers.
15 The typical use-case is where the content is a blog or news feed, but any type of content may be syndicated.
20 function usageSection(isPublicHub
, hubURL
) {
21 const usageContent
= isPublicHub
? ` <h2>Public Hub</h2>
23 This hub is available as a public resource; any topic which lists it as a hub can be syndicated.
26 To use this hub, your content needs to include some Link relations.
29 <h3>For Any Content</h3>
32 The content must be served with a <code>Link</code> HTTP header indicating this service as the <code>hub</code> relation.
34 <figcaption>Example:</figcaption>
36 Link: <${hubURL}>; rel="hub"
41 The content must be served with a <code>Link</code> HTTP header indicating its own URL with the <code>self</code> relation.
43 <figcaption>Example:</figcaption>
45 Link: <https://example.com/feed/>; rel="self"
52 <h3>For Atom or RSS feeds</h3>
55 The feed must include a <code>link</code> element within the <code>http://www.w3.org/2005/Atom</code> namespace with the <code>hub</code> relation and this service as the <code>href</code> attribute.
57 <figcaption>Example:</figcaption>
59 <link xmlns="http://www.w3.org/2005/Atom" href="${hubURL}" rel="hub">
64 The feed must include a <code>link</code> element within the <code>http://www.w3.org/2005/Atom</code> namespace with the <code>self</code> relation, its own URL as the <code>href</code> attribute, and its content-type as the <code>type</code> attribute.
66 <figcaption>Example:</figcaption>
68 <link xmlns="http://www.w3.org/2005/Atom" href="https://example.com/blog/feed" rel="self" type="application/atom+xml">
75 <h3>Publishing Updates</h3>
76 Send a <code>POST</code> request to this hub with Form Data:
79 <code>hub.mode</code> set to <code>publish</code>
82 <code>hub.url</code> set to the <code>self</code> link relation of the content
89 This hub only serves specific topics.
92 <section class="usage">
97 function contactSection(contactHTML
) {
100 section
= ` <section>
109 * @param {Object} ctx
110 * @param {Object} options
111 * @param {Object} options.manager
112 * @param {String} options.adminContactHTML
113 * @param {String} options.manager.pageTitle
114 * @param {String} options.manager.publicHub
115 * @param {Object} options.dingus
116 * @param {String} options.dingus.selfBaseUrl
119 module
.exports
= (ctx
, options
) => {
120 const pageTitle
= options
.manager
.pageTitle
;
121 const isPublicHub
= options
.manager
.publicHub
;
122 const contactHTML
= options
.adminContactHTML
;
123 const footerEntries
= options
.manager
.footerEntries
;
124 const hubURL
= options
.dingus
.selfBaseUrl
|| '<s>https://hub.example.com/</s>';
125 const headElements
= [];
127 const mainContent
= [
129 usageSection(isPublicHub
, hubURL
),
130 contactSection(contactHTML
),
132 return th
.htmlTemplate(1, pageTitle
, headElements
, navLinks
, mainContent
, footerEntries
,