Skip to content

Commit

Permalink
ISSUE-21: Index all pages (not just blog pages)
Browse files Browse the repository at this point in the history
Previously we only included links that end with `.html` from the
different sitemaps. Now we include all pages.

The same conditions used to exclude some specifig pages from our index
has been left in place. We also exclude URLs with a hash param.
Reject condition: `x.match?(/#.+\z/) || x.include?('page') || x.include?('/tags/') || x.include?('author')`

We removed the where condition in the links_controller.
Now links without published_at will show.
This also means that links without  published_at will appear at the top
of the links page.
See: https://stackoverflow.com/a/44912964

See: #21
  • Loading branch information
fbuys committed Oct 6, 2023
1 parent 43d91e8 commit 910934f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/links_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
end

# GET /links/1
Expand Down
4 changes: 3 additions & 1 deletion app/models/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 910934f

Please sign in to comment.