Files
growstuff/app/views/plantings/_meta.html.haml
T

25 lines
1.1 KiB
Plaintext

-# Title, description and OpenGraph for one planting. The same sentence
-# everywhere, so a shared link never reads as a page about the crop.
-#
-# The og tags themselves are shared with the other record pages; what is
-# particular to a planting is its rating and the crop's structured data,
-# appended below (content_for concatenates).
- fallback = t('plantings.show.meta_description', crop: planting.display_name,
owner: planting.owner, garden: planting.garden)
= render 'shared/record_meta',
title:,
description: planting.description.presence || fallback,
image: planting_image_path(planting)
- content_for :opengraph do
- if planting.overall_rating.present?
%script{ type: "application/ld+json" }
:plain
{
"@context": "http://schema.org",
"@type": "Rating",
"ratingValue": "#{planting.overall_rating}",
"bestRating": "5"
}
%script{ type: "application/ld+json" }
= crop_jsonld_data(planting.crop, full_attributes: false).to_json.html_safe