I’m trying to add atom feeds for each tag, and the common way to achieve this is by adding the following code to config.rb
:
ready do
blog.tags.each do |tag, articles|
page "/tags/#{tag}/#{tag.downcase}.xml", proxy: "/atom.xml", layout: false do
@tagname = tag
@articles = articles[0..10]
end
end
end
I put that just underneath my activate block for middleman-blog:
activate :blog do |blog|
blog.permalink = '{year}/{month}/{day}/{title}.html'
blog.tag_template = 'tag.html'
blog.calendar_template = 'calendar.html'
end
So with just the the active block, it works perfectly. However, as soon as I hit the above ready do
block, building fails:
Building blog (blog.foo.bar)
/home/red_trela/.gem/ruby/gems/middleman-blog-4.0.0/lib/middleman-blog/blog_data.rb:170: warning: duplicated key at line 170 ignored: :lang
== Blog Sources: {year}-{month}-{day}-{title}.html (:prefix + :sources)
/home/red_trela/git/mathys.io/blog/config.rb:92:in `block in evaluate_configuration!': undefined local variable or method `blog' for #<Middleman::ConfigContext:0x0056307e1869d8> (NameError)
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/callback_manager.rb:51:in `instance_exec'
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/callback_manager.rb:51:in `block in execute'
from /home/red_trela/.gem/ruby/gems/hamster-2.0.0/lib/hamster/vector.rb:1316:in `each'
from /home/red_trela/.gem/ruby/gems/hamster-2.0.0/lib/hamster/vector.rb:1316:in `traverse_depth_first'
from /home/red_trela/.gem/ruby/gems/hamster-2.0.0/lib/hamster/vector.rb:431:in `each'
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/callback_manager.rb:51:in `execute'
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/callback_manager.rb:28:in `block in install_methods!'
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/callback_manager.rb:52:in `instance_exec'
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/callback_manager.rb:52:in `block in execute'
from /home/red_trela/.gem/ruby/gems/hamster-2.0.0/lib/hamster/vector.rb:1316:in `each'
from /home/red_trela/.gem/ruby/gems/hamster-2.0.0/lib/hamster/vector.rb:1316:in `traverse_depth_first'
from /home/red_trela/.gem/ruby/gems/hamster-2.0.0/lib/hamster/vector.rb:431:in `each'
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/callback_manager.rb:52:in `execute'
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/callback_manager.rb:28:in `block in install_methods!'
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/application.rb:292:in `start_lifecycle'
from /home/red_trela/.gem/ruby/gems/middleman-core-4.0.0/lib/middleman-core/application.rb:265:in `initialize'
from /home/red_trela/.gem/ruby/gems/middleman-cli-4.0.0/lib/middleman-cli/build.rb:51:in `new'
from /home/red_trela/.gem/ruby/gems/middleman-cli-4.0.0/lib/middleman-cli/build.rb:51:in `build'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor.rb:40:in `block in register'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /home/red_trela/.gem/ruby/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/red_trela/.gem/ruby/gems/middleman-cli-4.0.0/bin/middleman:23:in `<top (required)>'
from /home/red_trela/bin/middleman:23:in `load'
from /home/red_trela/bin/middleman:23:in `<main>'
Idead? Any help is appreciated.