mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-29 04:02:17 -04:00
This commit improves the meta descriptions for several pages by making them dynamic and object-specific. - The default meta description in `app/views/layouts/_head.html.haml` has been updated to include a mention of open data. - The `show.html.haml` views for crops, seeds, plantings, harvests, and members now have a `content_for :meta_description` block. This block uses the object's description or bio if available, and falls back to a generated string if not.
80 lines
2.9 KiB
Plaintext
80 lines
2.9 KiB
Plaintext
= content_for :title, "#{@harvest.crop} harvested by #{@harvest.owner}"
|
|
- content_for :meta_description do
|
|
- if @harvest.description.present?
|
|
= @harvest.description
|
|
- else
|
|
= "#{@harvest.crop} harvested by #{@harvest.owner}."
|
|
- content_for :opengraph do
|
|
= tag("meta", property: "og:image", content: harvest_image_path(@harvest))
|
|
= tag("meta", property: "og:image:user_generated", content: "true")
|
|
= tag("meta", property: "og:title", content: "#{@harvest.crop} harvested by #{@harvest.owner}")
|
|
= tag("meta", property: "og:type", content: "website")
|
|
= tag("meta", property: "og:url", content: request.original_url)
|
|
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
|
|
|
%script{type: "application/ld+json"}
|
|
= crop_jsonld_data(@harvest.crop, full_attributes: false).to_json.html_safe
|
|
|
|
- content_for :breadcrumbs do
|
|
%li.breadcrumb-item= link_to 'Harvests', harvests_path
|
|
%li.breadcrumb-item= link_to @harvest.owner, member_harvests_path(@harvest.owner)
|
|
%li.breadcrumb-item.active= link_to @harvest, @harvest
|
|
|
|
.harvest
|
|
.row
|
|
.col-md-8.col-xs-12
|
|
.jumbotron
|
|
.d-flex.justify-content-between
|
|
%h1.display-3
|
|
= harvest_icon
|
|
%strong= @harvest.crop
|
|
%small.text-muted
|
|
harvested by
|
|
= @harvest.owner
|
|
|
|
- if @harvest.description.present?
|
|
:markdown
|
|
#{strip_tags markdownify(@harvest.description)}
|
|
|
|
= render partial: 'planting'
|
|
= render 'likes/likes', object: @harvest
|
|
= render 'harvests/actions', harvest: @harvest
|
|
|
|
.col-md-4.col-xs-12
|
|
= render 'harvests/owner', harvest: @harvest
|
|
.col-md-8.col-xs-12
|
|
.index-cards.facts
|
|
- if @harvest.plant_part
|
|
.card
|
|
%h3
|
|
Plant part
|
|
= editable :select, @harvest, :plant_part_id, collection: PlantPart.all.pluck(:name, :id), display_field: '.harvest-plantpart'
|
|
%strong.harvest-plantpart= @harvest.plant_part
|
|
.card
|
|
%h3
|
|
Harvested
|
|
= editable :date, @harvest, :harvested_at, display_field: '.harvested_at'
|
|
%strong.harvested_at #{standard_time_distance @harvest.harvested_at, Time.zone.now.to_date}
|
|
%span.harvested_at= I18n.l @harvest.harvested_at
|
|
|
|
.card{class: @harvest.quantity.present? ? '' : 'text-muted'}
|
|
%h3
|
|
Quantity
|
|
= editable :text_field, @harvest, :quantity, display_field: '.quantity'
|
|
%strong.quantity
|
|
= display_quantity(@harvest)
|
|
|
|
%section
|
|
%h2 Photos
|
|
= render 'photos/gallery', photos: @harvest.photos.order(date_taken: :desc)
|
|
= add_photo_button(@harvest)
|
|
%section.harvest-detail
|
|
%h2 Detail
|
|
- if @harvest.planting.present?
|
|
Havested from
|
|
= link_to @harvest.planting, @harvest.planting
|
|
|
|
.col-md-4.col-xs-12
|
|
= render @harvest.crop
|
|
= render 'crops/nutritional_data', crop: @harvest.crop
|