X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=src%2Ftemplate%2Froot-html.js;h=d035bb8c342da6ca94b3f93fd4f25cfcb1398a4d;hb=1c37a7c533a5530390489ea9a49dcca492db1074;hp=97a1ad9c99c1b700a9b155935b83fc4c1ba8f0d3;hpb=9696c012e6b9a6c58904baa397ca0ebf78112316;p=websub-hub diff --git a/src/template/root-html.js b/src/template/root-html.js index 97a1ad9..d035bb8 100644 --- a/src/template/root-html.js +++ b/src/template/root-html.js @@ -2,6 +2,27 @@ const th = require('./template-helper'); +/** + * + * @param {string} pageTitle page title + * @param {string} logoUrl logo url + * @returns {string} element + */ +function hAppSection(pageTitle, logoUrl) { + return ` `; +} + +/** + * @returns {string} element + */ function aboutSection() { return `

What

@@ -17,6 +38,12 @@ function aboutSection() {
`; } +/** + * + * @param {boolean} isPublicHub is public hub + * @param {string} hubURL hub url + * @returns {string} html + */ function usageSection(isPublicHub, hubURL) { const usageContent = isPublicHub ? `

Public Hub

@@ -46,6 +73,15 @@ function usageSection(isPublicHub, hubURL) { +

  • + Ideally, these should be combined in one header. +
    +
    Example:
    + + Link: <${hubURL}>; rel="hub", <https://example.com/feed/>; rel="self" + +
    +
  • @@ -73,17 +109,23 @@ function usageSection(isPublicHub, hubURL) {

    Publishing Updates

    - Send a POST request to this hub with Form Data: + To notify the Hub either of a new topic to syndicate, or that a topic's content has been updated and should be distributed to subscribers, send a POST request with Form Data (application/x-www-form-urlencoded): +
    +
    Example:
    + + curl ${hubURL} -d'hub.mode=publish' -d'hub.url=https://example.com/blog_one/feed' -d'hub.url=https://example.com/blog_two/feed' + +
    ` - : ` + : `

    Private Hub

    This hub only serves specific topics. @@ -94,6 +136,11 @@ ${usageContent} `; } +/** + * + * @param {string} contactHTML html + * @returns {string} html + */ function contactSection(contactHTML) { let section = ''; if (contactHTML) { @@ -106,26 +153,37 @@ ${contactHTML} /** * - * @param {Object} ctx - * @param {Object} options - * @param {Object} options.manager - * @param {String} options.adminContactHTML - * @param {String} options.manager.pageTitle - * @param {String} options.manager.publicHub - * @param {Object} options.dingus - * @param {String} options.dingus.selfBaseUrl - * @returns {String} + * @param {object} ctx context + * @param {object} options options + * @param {object} options.manager manager options + * @param {string} options.adminContactHTML html + * @param {string} options.manager.pageTitle title + * @param {string} options.manager.publicHub is public + * @param {object} options.dingus dingus options + * @param {string} options.dingus.selfBaseUrl url + * @returns {string} html */ module.exports = (ctx, options) => { const pageTitle = options.manager.pageTitle; const isPublicHub = options.manager.publicHub; const contactHTML = options.adminContactHTML; + const footerEntries = options.manager.footerEntries; const hubURL = options.dingus.selfBaseUrl || 'https://hub.example.com/'; - const headElements = []; - const navLinks = []; - return th.htmlTemplate(1, pageTitle, headElements, navLinks, [ + const navLinks = [{ + href: 'admin/', + text: 'Admin', + }]; + const htmlOptions = { + pageTitle, + logoUrl: options.manager.logoUrl, + footerEntries, + navLinks, + }; + const content = [ aboutSection(), usageSection(isPublicHub, hubURL), contactSection(contactHTML), - ]); + hAppSection(pageTitle, options.manager.logoUrl), + ]; + return th.htmlPage(0, ctx, htmlOptions, content); }; \ No newline at end of file