git ssb

2+

cel / scuttlebot.io



Tree: 6a055e1be48956691b060c261266f3d9e41250d9

Files: 6a055e1be48956691b060c261266f3d9e41250d9 / tmpl / page.part.js

1314 bytesRaw
1var head = require('./head.part')
2var tabs = require('./tabs.part')
3var leftnav = require('./leftnav.part')
4var footer = require('./footer.part')
5
6module.exports = (opts) => {
7
8 // render the hero
9 var hero = ''
10 if (opts.hero) {
11 hero = opts.hero
12 } else {
13 hero = `<div class="hero small">
14 <h1><a href="/"><img src="/img/hermies-256.png"></a> Scuttlebot</h1>
15 </div>`
16 }
17
18 // pick the navs
19 var tabFn = tabs[opts.section || 'docs'] || function () { return '' }
20 var leftnavFn = leftnav[opts.tab || 'basics']
21
22 // next and see-also
23 var seeAlso = '', next = ''
24 if (opts.seeAlso)
25 seeAlso = `<ul class="see-also">` + opts.seeAlso.map(item => `<li><a href="${item[0]}">${item[1]}</a></li>`).join('') + `</ul>`
26 if (opts.next)
27 next = `<p class="next"><a href="${opts.next[0]}">${opts.next[1]}</a></p>`
28
29 // render the page
30 return `<html>
31 ${head({ title: opts.title, canonicalUrl: opts.canonicalUrl })}
32 <body>
33 ${hero}
34 ${tabs.sections(opts.section)}
35 ${tabFn(opts.tab)}
36 <div class="nav-content-unit ${!leftnavFn?'nonav':''}">
37 ${leftnavFn ? leftnavFn(opts.path) : ''}
38 <div class="content">
39 ${opts.content}
40 ${seeAlso}
41 ${next}
42 </div>
43 </div>
44 ${footer(opts.path)}
45 </body>
46 </html>`
47}

Built with git-ssb-web