diff --git a/app/controllers/links_controller.rb b/app/controllers/links_controller.rb index ae76e62..960b3d5 100644 --- a/app/controllers/links_controller.rb +++ b/app/controllers/links_controller.rb @@ -8,7 +8,7 @@ def index else Link end - @links = scope.where("published_at IS NOT NULL").order(published_at: "DESC") + @links = scope.order("published_at DESC NULLS LAST") end # GET /links/1 diff --git a/app/models/link.rb b/app/models/link.rb index f3bb7eb..826f340 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -8,7 +8,9 @@ class Link < ApplicationRecord class << self def find_urls(sitemap) - sitemap.to_a.select {|x| x.end_with? ".html" }.reject {|x| x.include?("page") || x.include?("/tags/") || x.include?("author") } + sitemap.to_a.reject do |x| + x.match?(/#.+\z/) || x.include?('page') || x.include?('/tags/') || x.include?('author') + end end def find_description(page)