Skip to content

Instantly share code, notes, and snippets.

@heatherm
Created March 18, 2012 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heatherm/2078289 to your computer and use it in GitHub Desktop.
Save heatherm/2078289 to your computer and use it in GitHub Desktop.
toto with github highlights and disqus
<article class="post">
<header>
<h1><%= title %></h1>
<span class="date"><%= date %></span>
</header>
<section class="content">
<%= body %>
</section>
<section class="comments">
<% if @config[:disqus] %>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'heathrmoor'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + 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>
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
<% end %>
</section>
</article>
require 'toto'
require File.expand_path('../config/environment.rb', __FILE__)
use Rack::Static, :urls => ['/stylesheets', '/javascripts', '/images',
'/favicon.ico'], :root => 'public'
use Rack::ShowExceptions
use Rack::CommonLogger
toto = Toto::Server.new do
Toto::Paths = {
:templates => 'blog/templates',
:pages => 'blog/templates/pages',
:articles => 'blog/articles'
}
set :date, lambda {|now| now.strftime("%B #{now.day.ordinal} %Y") }
set :summary, :max => 500
set :prefix, "blog"
set :disqus, "heathrmoor"
set :title, 'Heather Moore'
set :url, 'http://heathrmoor.com/blog'
end
app = Rack::Builder.new do
use Rack::Logger
map '/blog' do
run toto
end
map '/' do
run MyAppThatHasTotoInside::Application
end
end.to_app
run app
<section id="articles">
<% for article in articles[0...3] %>
<article class="post">
<header>
<h1><a href="<%= article.path %>"><%= article.title %></a></h1>
<div><a href="<%= article.path %>#disqus_thread"></a></div>
<span class="date"><%= article.date %></span>
</header>
<section class="content">
<%= article.summary %>
</section>
<div class="more"><a href="<%= article.path %>">read on &raquo;</a></div>
</article>
<% end %>
</section>
<section id="archives">
<%= archives[3..-1] %>
</section>
<html>
<head>
<link rel="alternate" type="application/atom+xml" title="<%= title %> - feed" href="/index.xml" />
<script src="http://yandex.st/highlightjs/6.1/highlight.min.js"></script>
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.1/styles/github.min.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>hm | blog</title>
</head>
<body class="blog">
<section>
<%= yield %>
</section>
<script type="text/javascript">
hljs.initHighlighting();
</script>
<footer>
powered by <a href="http://cloudhead.io/toto">toto</a>
</footer>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'heathrmoor'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment