Skip to content

Commit

Permalink
Données statiques pour les moteurs de recherche externes (#2600)
Browse files Browse the repository at this point in the history
* added in core

* fix

* fix

* fix

* fix

* Fix #2644

* Update app/views/admin/application/static/_core.html.erb

Co-authored-by: Sébastien Gaya <sebastien.gaya@gmail.com>

---------

Co-authored-by: Sébastien Gaya <sebastien.gaya@gmail.com>
  • Loading branch information
arnaudlevy and SebouChu authored Feb 13, 2025
1 parent 718d1bb commit 0f40417
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions app/views/admin/application/static/_core.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%
# Partial arguments
# Partial arguments
forced_title ||= nil
skip_date ||= false
# Preparing variables
Expand Down Expand Up @@ -73,4 +73,28 @@ meta:
updated_at: <%= about.updated_at&.iso8601 %>
<% if show_published_at %>
published_at: <%= about.published_at&.iso8601 %>
<% end %>
<% end %>
<%
#############
# Search engine data
#############
search_title = title
search_title += " #{about.subtitle}" if show_subtitle && about.subtitle.present?
%>
search:
id: "<%= about.id %>"
url: "<%= hugo.permalink %>"
kind: "<%= about.class.model_name %>"
<% if about.respond_to?(:language) && about.language.present? %>
lang: "<%= about.language.iso_code %>"
<% end %>
title: >-
<%= prepare_text_for_static search_title %>
<% if about.respond_to?(:summary) %>
summary: >-
<%= prepare_html_for_static about.summary %>
<% end %>
<% if about.respond_to?(:contents_full_text) %>
body: >-
<%= prepare_text_for_static about.contents_full_text %>
<% end %>

0 comments on commit 0f40417

Please sign in to comment.