Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Helpers
- module Items
- class Nanoc::Item
- # path gibt die "URL" zum Item zurück
- old_path = instance_method(:path)
- define_method(:path) do |params = { }|
- # Für manche Items will ich direkt auf eine andere Seite linken
- return @site.items.find!(self[:forward]).path if self[:forward]
- # Oder, falls nicht geforwarded, einfach den normalen path angeben
- old_path.bind(self).call(params)
- end
- # Den original-Path brauch ich an manchen Stellen auch noch...
- define_method(:unfordwarded_path) do |params = { }|
- old_path.bind(self).call(params)
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment