ドキュメントにDisqus設置
This commit is contained in:
		
							parent
							
								
									a4788fae45
								
							
						
					
					
						commit
						6b567fdc05
					
				
					 4 changed files with 34 additions and 4 deletions
				
			
		| 
						 | 
					@ -10,9 +10,9 @@ block main
 | 
				
			||||||
	p#url
 | 
						p#url
 | 
				
			||||||
		span.method POST
 | 
							span.method POST
 | 
				
			||||||
		span.host
 | 
							span.host
 | 
				
			||||||
			= url.host
 | 
								= endpointUrl.host
 | 
				
			||||||
			| /
 | 
								| /
 | 
				
			||||||
		span.path= url.path
 | 
							span.path= endpointUrl.path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if endpoint.desc
 | 
						if endpoint.desc
 | 
				
			||||||
		p#desc= endpoint.desc[lang] || endpoint.desc['ja']
 | 
							p#desc= endpoint.desc[lang] || endpoint.desc['ja']
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,28 @@ html(lang= lang)
 | 
				
			||||||
				if content
 | 
									if content
 | 
				
			||||||
					| !{content}
 | 
										| !{content}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								aside.
 | 
				
			||||||
 | 
									<div id="disqus_thread"></div>
 | 
				
			||||||
 | 
									<script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									/**
 | 
				
			||||||
 | 
									*  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
 | 
				
			||||||
 | 
									*  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
 | 
				
			||||||
 | 
									/*
 | 
				
			||||||
 | 
									var disqus_config = function () {
 | 
				
			||||||
 | 
									this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
 | 
				
			||||||
 | 
									this.page.identifier = "#{ id }"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
 | 
				
			||||||
 | 
									};
 | 
				
			||||||
 | 
									*/
 | 
				
			||||||
 | 
									(function() { // DON'T EDIT BELOW THIS LINE
 | 
				
			||||||
 | 
									var d = document, s = d.createElement('script');
 | 
				
			||||||
 | 
									s.src = 'https://misskey.disqus.com/embed.js';
 | 
				
			||||||
 | 
									s.setAttribute('data-timestamp', +new Date());
 | 
				
			||||||
 | 
									(d.head || d.body).appendChild(s);
 | 
				
			||||||
 | 
									})();
 | 
				
			||||||
 | 
									</script>
 | 
				
			||||||
 | 
									<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			footer
 | 
								footer
 | 
				
			||||||
				block footer
 | 
									block footer
 | 
				
			||||||
				small= copyright
 | 
									small= copyright
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,12 @@ main
 | 
				
			||||||
		border none
 | 
							border none
 | 
				
			||||||
		border-bottom solid 2px #eee
 | 
							border-bottom solid 2px #eee
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	footer
 | 
						> aside
 | 
				
			||||||
 | 
							margin-top 32px
 | 
				
			||||||
 | 
							padding-top 32px
 | 
				
			||||||
 | 
							border-top solid 2px #eee
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						> footer
 | 
				
			||||||
		margin 32px 0 0 0
 | 
							margin 32px 0 0 0
 | 
				
			||||||
		border-top solid 2px #eee
 | 
							border-top solid 2px #eee
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -173,9 +173,10 @@ router.get('/*/api/endpoints/*', async ctx => {
 | 
				
			||||||
	const ep = endpoints.find(e => e.name === name);
 | 
						const ep = endpoints.find(e => e.name === name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const vars = {
 | 
						const vars = {
 | 
				
			||||||
 | 
							id: `api/endpoints/${name}`,
 | 
				
			||||||
		title: name,
 | 
							title: name,
 | 
				
			||||||
		endpoint: ep.meta,
 | 
							endpoint: ep.meta,
 | 
				
			||||||
		url: {
 | 
							endpointUrl: {
 | 
				
			||||||
			host: config.api_url,
 | 
								host: config.api_url,
 | 
				
			||||||
			path: name
 | 
								path: name
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
| 
						 | 
					@ -198,6 +199,7 @@ router.get('/*/api/entities/*', async ctx => {
 | 
				
			||||||
	const x = yaml.safeLoad(fs.readFileSync(path.resolve(__dirname + '/../../../src/docs/api/entities/' + entity + '.yaml'), 'utf-8')) as any;
 | 
						const x = yaml.safeLoad(fs.readFileSync(path.resolve(__dirname + '/../../../src/docs/api/entities/' + entity + '.yaml'), 'utf-8')) as any;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	await ctx.render('../../../../src/docs/api/entities/view', Object.assign(await genVars(lang), {
 | 
						await ctx.render('../../../../src/docs/api/entities/view', Object.assign(await genVars(lang), {
 | 
				
			||||||
 | 
							id: `api/entities/${entity}`,
 | 
				
			||||||
		name: x.name,
 | 
							name: x.name,
 | 
				
			||||||
		desc: x.desc,
 | 
							desc: x.desc,
 | 
				
			||||||
		props: sortParams(Object.entries(x.props).map(([k, v]) => parsePropDefinition(k, v))),
 | 
							props: sortParams(Object.entries(x.props).map(([k, v]) => parsePropDefinition(k, v))),
 | 
				
			||||||
| 
						 | 
					@ -228,6 +230,7 @@ router.get('/*/*', async ctx => {
 | 
				
			||||||
	const md = fs.readFileSync(`${__dirname}/../../../src/docs/${doc}.${lang}.md`, 'utf8');
 | 
						const md = fs.readFileSync(`${__dirname}/../../../src/docs/${doc}.${lang}.md`, 'utf8');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	await ctx.render('../../../../src/docs/article', Object.assign({
 | 
						await ctx.render('../../../../src/docs/article', Object.assign({
 | 
				
			||||||
 | 
							id: doc,
 | 
				
			||||||
		html: conv.makeHtml(md),
 | 
							html: conv.makeHtml(md),
 | 
				
			||||||
		title: md.match(/^# (.+?)\r?\n/)[1],
 | 
							title: md.match(/^# (.+?)\r?\n/)[1],
 | 
				
			||||||
		src: `https://github.com/syuilo/misskey/tree/master/src/docs/${doc}.${lang}.md`
 | 
							src: `https://github.com/syuilo/misskey/tree/master/src/docs/${doc}.${lang}.md`
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue