From 2b4677cddb73ca1760a68c80a42c958fcd2ff8dd Mon Sep 17 00:00:00 2001 From: cleiviane Date: Fri, 5 Apr 2019 18:34:08 -0300 Subject: [PATCH] Remove the sitemap generator config --- Gemfile.lock | 12 ++++-------- _plugins/sitemap.rb | 27 --------------------------- blog.gemspec | 1 - robots.txt | 2 ++ spec/blog_spec.rb | 6 ------ 5 files changed, 6 insertions(+), 42 deletions(-) delete mode 100644 _plugins/sitemap.rb create mode 100644 robots.txt diff --git a/Gemfile.lock b/Gemfile.lock index b7b976c3..060984d6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,6 @@ PATH rake (~> 12.3) redcarpet rspec - sitemap_generator GEM remote: https://rubygems.org/ @@ -25,14 +24,13 @@ GEM tzinfo (~> 1.1) addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) - builder (3.2.3) byebug (10.0.2) coderay (1.1.2) colorator (1.1.0) colorize (0.8.1) concurrent-ruby (1.1.4) diff-lcs (1.3) - dotenv (2.6.0) + dotenv (2.7.2) ethon (0.11.0) ffi (>= 1.3.0) ffi (1.10.0) @@ -75,7 +73,7 @@ GEM jekyll-watch (1.5.1) listen (~> 3.0) kramdown (1.17.0) - liquid (4.0.1) + liquid (4.0.3) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -125,14 +123,12 @@ GEM rspec-support (~> 3.8.0) rspec-support (3.8.0) ruby_dep (1.5.0) - safe_yaml (1.0.4) - sass (3.7.3) + safe_yaml (1.0.5) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sitemap_generator (6.0.2) - builder (~> 3.0) slop (3.6.0) thor (0.19.4) thread_safe (0.3.6) diff --git a/_plugins/sitemap.rb b/_plugins/sitemap.rb deleted file mode 100644 index 2ff87ebc..00000000 --- a/_plugins/sitemap.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'sitemap_generator' - -Jekyll::Hooks.register :site, :post_write do |site| - unless site.config["watch"] - puts "Generating sitemap.xml.gz" - - files = [] - Dir['_site/**/*.html'].each do |page| - files << File.new(page) - end - - SitemapGenerator::Sitemap.default_host = site.config['url'] + "/blog" - public_path = Dir.pwd.end_with?("blog") ? "_site" : "public/blog" - SitemapGenerator::Sitemap.public_path = public_path - SitemapGenerator::Sitemap.create compress: false do - files.each do |file| - add file.path.sub(/^_site/,''), changefreq: 'weekly' - end - end - - puts "Generated sitemap.xml.gz" - end - - puts "Running tests..." - system "bundle exec rspec spec/blog_spec.rb" - puts "All done!" -end diff --git a/blog.gemspec b/blog.gemspec index ba48781d..8f71f36d 100644 --- a/blog.gemspec +++ b/blog.gemspec @@ -15,7 +15,6 @@ Gem::Specification.new do |s| s.add_dependency('jekyll-titleize') s.add_dependency('jekyll-paginate') s.add_dependency('jekyll-feed') - s.add_dependency('sitemap_generator') s.add_dependency('dotenv') s.add_dependency('rspec') diff --git a/robots.txt b/robots.txt new file mode 100644 index 00000000..f0830c96 --- /dev/null +++ b/robots.txt @@ -0,0 +1,2 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +Sitemap: http://bundler-audit-production.s3.amazonaws.com/blog_sitemap.xml diff --git a/spec/blog_spec.rb b/spec/blog_spec.rb index 6a0e18ba..201c6da3 100644 --- a/spec/blog_spec.rb +++ b/spec/blog_spec.rb @@ -30,12 +30,6 @@ expect(data['twitter:image:src']).to eq 'https://fastruby.io/blog/assets/images/profile.png' end - it 'generates the sitemap with correct domain name' do - doc = Nokogiri::XML(IO.read('_site/sitemap.xml')) - url = doc.xpath('/aws:urlset/aws:url/aws:loc', 'aws' => 'http://www.sitemaps.org/schemas/sitemap/0.9')[0] - expect(url.text).to eq 'https://fastruby.io/blog' - end - it 'generates share button for twitter' do doc = Nokogiri::HTML(IO.read(file_path)) href = doc.search('.icon-twitter').first['href']