Skip to content

Commit 5e2b520

Browse files
committed
now uses full text from external posts for indexing
1 parent 2e00924 commit 5e2b520

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

_plugins/external-posts.rb

+3-6
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ def create_document(site, source_name, url, content)
6262
doc.data['description'] = content[:summary]
6363
doc.data['date'] = content[:published]
6464
doc.data['redirect'] = url
65-
if content[:summary]
66-
doc.content = content[:title] + '. ' + content[:summary]||''
67-
else
68-
doc.content = content[:title] + '. ' + content[:content]||''
69-
end
65+
doc.content = content[:content]
7066
site.collections['posts'].docs << doc
7167
end
7268

@@ -99,7 +95,8 @@ def fetch_content_from_url(url)
9995
description ||= parsed_html.at('head meta[name="og:description"]')&.attr('content')
10096
description ||= parsed_html.at('head meta[property="og:description"]')&.attr('content')
10197

102-
body_content = parsed_html.at('body')&.inner_html || ''
98+
body_content = parsed_html.search('p').map { |e| e.text }
99+
body_content = body_content.join() || ''
103100

104101
{
105102
title: title,

0 commit comments

Comments
 (0)