Using external comment system with generated HTML

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Using external comment system with generated HTML

ctargett
Hi -

I've searched a bit for this, and can't find anything, so apologies if it's been covered before.

I am developing a POC to get a project I work on to switch documentation to Asciidoc format. One gap between our current system and my POC is the ability to add comments to the online documentation. We have the ability to use an externally managed comment system, but I need to add a little javascript snippet to every page that includes the page name.

I'm struggling with how to add it to every rendered HTML page above the footer. I'm using a docinfo-footer.html for the footer, but if I add the js snippet there, it renders inside the footer. I add it to the docinfo.html page instead, it renders at the top of the page. Any ideas how I can add it after the <body> but before the <footer>?

Thanks in advance -
Cassandra
Reply | Threaded
Open this post in threaded view
|

Re: Using external comment system with generated HTML

jasondlee
I'm using Asciidoctor in conjunction with JBake to generate a static blog (blogs.steeplesoft.com). I have the Disqus JS in the JBake template, which is then wrapped around the Asciidoctor output, in case that helps any. You can see my source and build here:

https://bitbucket.org/jdlee/steeplesoft-blog

On 10/6/15 11:07 AM, ctargett [via Asciidoctor :: Discussion] wrote:
Hi -

I've searched a bit for this, and can't find anything, so apologies if it's been covered before.

I am developing a POC to get a project I work on to switch documentation to Asciidoc format. One gap between our current system and the POC I'm working on is the ability to add comments to the online documentation. We have the ability to use an externally managed comment system, but I need to add a little javascript snippet to every page that includes the page name.

I'm struggling with how to add it to every rendered HTML page above the footer. I'm using a docinfo-footer.html for the footer, but if I had the js snippet there, it renders inside the footer. I added it to the docinfo.html page instead, and it renders at the top of the page. Any ideas how I can add it after the <body> but before the <footer>?

Thanks in advance -
Cassandra


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Using-external-comment-system-with-generated-HTML-tp3823.html
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML

-- 
Jason Lee
http://cubtracker.com 
http://blogs.steeplesoft.com
http://twitter.com/jasondlee
http://blogs.steeplesoft.com/+
http://blogs.steeplesoft.com/in
Reply | Threaded
Open this post in threaded view
|

Re: Using external comment system with generated HTML

LightGuardjp
As Jason has said, for something like this you're better off using a site generator to add things like that. People have successfully used JBake, awestruct, middleman, jekyll, and the like for doing this stuff.

On Tue, Oct 6, 2015 at 10:11 AM, jasondlee [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I'm using Asciidoctor in conjunction with JBake to generate a static blog (blogs.steeplesoft.com). I have the Disqus JS in the JBake template, which is then wrapped around the Asciidoctor output, in case that helps any. You can see my source and build here:

https://bitbucket.org/jdlee/steeplesoft-blog

On 10/6/15 11:07 AM, ctargett [via Asciidoctor :: Discussion] wrote:
Hi -

I've searched a bit for this, and can't find anything, so apologies if it's been covered before.

I am developing a POC to get a project I work on to switch documentation to Asciidoc format. One gap between our current system and the POC I'm working on is the ability to add comments to the online documentation. We have the ability to use an externally managed comment system, but I need to add a little javascript snippet to every page that includes the page name.

I'm struggling with how to add it to every rendered HTML page above the footer. I'm using a docinfo-footer.html for the footer, but if I had the js snippet there, it renders inside the footer. I added it to the docinfo.html page instead, and it renders at the top of the page. Any ideas how I can add it after the <body> but before the <footer>?

Thanks in advance -
Cassandra


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Using-external-comment-system-with-generated-HTML-tp3823.html
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML

-- 
Jason Lee
http://cubtracker.com 
http://blogs.steeplesoft.com
http://twitter.com/jasondlee
http://blogs.steeplesoft.com/+
http://blogs.steeplesoft.com/in



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Using-external-comment-system-with-generated-HTML-tp3823p3824.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Ted
Reply | Threaded
Open this post in threaded view
|

Re: Using external comment system with generated HTML

Ted
In reply to this post by ctargett
ctargett wrote
...We have the ability to use an externally managed comment system, but I need to add a little javascript snippet to every page that includes the page name.

I'm struggling with how to add it to every rendered HTML page above the footer. I'm using a docinfo-footer.html for the footer, but if I add the js snippet there, it renders inside the footer. I add it to the docinfo.html page instead, it renders at the top of the page. Any ideas how I can add it after the <body> but before the <footer>?

Thanks in advance -
Cassandra
If you can't move the display of the comments with some CSS, another option would be to use your own custom HTML template.

I've just started exploring this. Here's what my custom template looks like: http://tedbergeron.github.io/AsciidoctorCustomTemplate/

And here are the files used. https://github.com/tedbergeron/AsciidoctorCustomTemplate

You will find the template here: https://github.com/tedbergeron/AsciidoctorCustomTemplate/blob/gh-pages/template/slim/document.html.slim

I barely know anything about Slim templates, but I would think you could add a line of JavaScript to this to see if your Proof of Concept would work.

Add JavaScript to Slim Template:

1) Link to external nameOfFile.js

 = javascript_include_tag nameOfFile.js
 
2) Or directly adding the JavaScript code to your Slim file, using

 javascript:
   code line 1
   code line 2

More information about Slim: http://slim-lang.com/
- Ted @TedAtCIS
Reply | Threaded
Open this post in threaded view
|

Re: Using external comment system with generated HTML

mojavelinux
Administrator
In reply to this post by ctargett

On Tue, Oct 6, 2015 at 10:07 AM, ctargett [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I'm using a docinfo-footer.html for the footer, but if I had the js snippet there, it renders inside the footer. I added it to the docinfo.html page instead, and it renders at the top of the page. Any ideas how I can add it after the <body> but before the <footer>?

I'm actually thinking about changing the placement of the docinfo footer so it is outside of the footer div. It should also be included even if the nofooter attribute is set. This would allow you to use the nofooter attribute plus a docinfo footer to provide your own footer content (just before the closing body tag), which is exactly what you are shooting for.


But do take some of the other advice in this thread to heart. The default HTML converter is meant to be just that, a default starting point. If you really want control over the layout of the pages that are produced, I recommend looking into using a static site generator. There are many of them.

As Ted suggested, if you don't want to go the static HTML route, you can create your own templates to control the output of any element in the AsciiDoc structure, including the layout of the page itself.

Cheers,

-Dan

--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Using external comment system with generated HTML

ctargett
Thanks everyone for the help and suggestions. I hoped to avoid a static site generator, just for build simplicity, but there are some other things we'll want to add for navigation, etc., so maybe it's the best option.

I wanted to check out these options this week, but other stuff got in the way. I'll definitely try to get back to this soon. Thanks again.