Sha256: ed40f4cc562d5725a9578867b2b6169388ea229d6ec7eb13688e8039478099b1
Contents?: true
Size: 1.19 KB
Versions: 45
Compression:
Stored size: 1.19 KB
Contents
namespace :alchemy do namespace :convert do namespace :urlnames do desc "Converts the urlname of all pages to nested url paths." task to_nested: [:environment] do unless Alchemy::Config.get(:url_nesting) raise "\nURL nesting is disabled! Please enable url_nesting in `config/alchemy/config.yml` first.\n\n" end puts "Converting..." pages = Alchemy::Page.contentpages count = pages.count pages.each_with_index do |page, n| puts "Updating page #{n + 1} of #{count}" page.update_urlname! end puts "Done." end desc "Converts the urlname of all pages to contain the slug only." task to_slug: [:environment] do if Alchemy::Config.get(:url_nesting) raise "\nURL nesting is enabled! Please disable url_nesting in `config/alchemy/config.yml` first.\n\n" end puts "Converting..." pages = Alchemy::Page.contentpages count = pages.count pages.each_with_index do |page, n| puts "Updating page #{n + 1} of #{count}" page.update_attribute :urlname, page.slug end puts "Done." end end end end
Version data entries
45 entries across 45 versions & 1 rubygems