Skip to content

Commit

Permalink
Bugfix: indexed_posts is also used in fallback mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mkasberg committed Apr 23, 2024
1 parent 4c1f1e6 commit c18e079
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/jekyll_ai_related_posts/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ def generate(site)
@site = site
setup_database

@indexed_posts = {}
site.posts.docs.each do |p|
@indexed_posts[p.relative_path] = p
end

if fetch_enabled?
Jekyll.logger.info "[ai_related_posts] Generating related posts..."
@embeddings_fetcher = new_fetcher
Expand All @@ -20,11 +25,6 @@ def generate(site)
ensure_embedding_cached(p)
end

@indexed_posts = {}
site.posts.docs.each do |p|
@indexed_posts[p.relative_path] = p
end

@site.posts.docs.each do |p|
find_related(p)
end
Expand Down

0 comments on commit c18e079

Please sign in to comment.