Sha256: d024732b9092870de5aeff7b64f11161ad63a919821040d2e5429cc4b435eb03
Contents?: true
Size: 1.19 KB
Versions: 44
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
44 entries across 44 versions & 2 rubygems