diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-16 04:26:16 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:18 -0500 |
commit | 49535c6a1a6dc63daa1158dddac6155e999a4919 (patch) | |
tree | 76666f10ccc949ac8b8de30db4fdf8e14d7a4e55 /app | |
parent | 6e28a99c8e46295dd049f7af45565d4bea97c725 (diff) |
[Articles] Add permalink to article summaries
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/formatter.rb | 6 | ||||
-rw-r--r-- | app/lib/sanitize_config.rb | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index bf99701b7..dec60a3ea 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -76,6 +76,7 @@ class Formatter end html = format_article_content(summary, html) if options[:article_content] && summary.present? + html = format_article_summary(html, status) if !options[:article_content] && summary.present? html.html_safe # rubocop:disable Rails/OutputSafety end @@ -89,6 +90,11 @@ class Formatter text.html_safe # rubocop:disable Rails/OutputSafety end + def format_article_summary(html, status) + status_url = ActivityPub::TagManager.instance.url_for(status) + "#{html}\n<p data-name=\"permalink\"><span>📄 </span>#{link_url(status_url)}</p>" + end + def format_article_content(summary, html) "<blockquote data-name=\"summary\">#{format_summary(summary, html)}</blockquote>#{html}" end diff --git a/app/lib/sanitize_config.rb b/app/lib/sanitize_config.rb index 102dce2d2..93260c7dc 100644 --- a/app/lib/sanitize_config.rb +++ b/app/lib/sanitize_config.rb @@ -43,7 +43,7 @@ class Sanitize return unless name_list name_list.keep_if do |name| - next true if %w(summary abstract).include?(name) + next true if %w(summary abstract permalink).include?(name) end node['data-name'] = name_list.join(' ') |