Thanks, that worked.

By on 9/18/2014 8:19 AM ()

In CloudSharper blogs, we use sitelet templates to insert the HTML snippet from Disqus's documentation:

disqus_insert.html: (note the ${variables} for the sitelet template)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<div id="disqus_thread"></div>
<script type="text/javascript"><![CDATA[
  var disqus_shortname = 'YOUR_WEBSITE_SHORTNAME';
  var disqus_identifier = '${ArticleId}';
  var disqus_title = '${ArticleTitle}';
  var disqus_url = '${ArticleUrl}';

  /* * * DON'T EDIT BELOW THIS LINE * * */
  (function() {
  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
]]></script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

F# code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
    module Disqus =

        type Insert =
            {
                ArticleId: string
                ArticleTitle: string
                ArticleUrl: string
            }

        let private InsertTemplate =
            let path = HttpContext.Current.Server.MapPath "~/disqus_insert.html"
            Content.Template<Insert>(path, Content.Template.Once)
                .With("ArticleId", fun x -> x.ArticleId)
                .With("ArticleTitle", fun x -> x.ArticleTitle)
                .With("ArticleUrl", fun x -> x.ArticleUrl)

        let Insert i =
            InsertTemplate.Run(i)
By on 9/11/2014 5:10 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper