mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-11 09:17:20 -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.
76 lines
2.8 KiB
Plaintext
76 lines
2.8 KiB
Plaintext
- content_for :title, "#{@seed.owner}'s #{@seed.crop} seeds"
|
|
- content_for :meta_description do
|
|
- if @seed.description.present?
|
|
= @seed.description
|
|
- else
|
|
= "Seeds for #{@seed.crop.name}, shared by #{@seed.owner}."
|
|
- content_for :opengraph do
|
|
= tag("meta", property: "og:image", content: seed_image_path(@seed))
|
|
- if @seed.description
|
|
= tag("meta", property: "og:description", content: og_description(@seed.description))
|
|
= tag("meta", property: "og:image", content: "#{@seed.owner}'s #{@seed.crop} seeds")
|
|
= 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(@seed.crop, full_attributes: false).to_json.html_safe
|
|
|
|
- content_for :breadcrumbs do
|
|
%li.breadcrumb-item= link_to 'Seeds', seeds_path
|
|
%li.breadcrumb-item= link_to @seed.owner, member_seeds_path(@seed.owner)
|
|
%li.breadcrumb-item.active= link_to @seed, @seed
|
|
|
|
.seed
|
|
.row
|
|
.col-md-9.col-12
|
|
.jumbotron
|
|
.d-flex.justify-content-between
|
|
%h1.display-3
|
|
= crop_icon(@seed.crop)
|
|
= @seed.crop.name.titleize
|
|
seeds
|
|
%span.text-muted= I18n.l @seed.created_at.to_date
|
|
- if @seed.organic != 'unknown'
|
|
.badge.badge-success.seedtitle--organic= @seed.organic
|
|
- if @seed.gmo != 'unknown'
|
|
.badge.badge-success.seedtitle--gmo= @seed.gmo
|
|
- if @seed.heirloom != 'unknown'
|
|
.badge.badge-success.seedtitle--heirloom= @seed.heirloom
|
|
- if @seed.parent_planting
|
|
%p
|
|
Saved from planting:
|
|
= planting_icon
|
|
= link_to @seed.parent_planting, planting_path(@seed.parent_planting)
|
|
= render 'seeds/actions', seed: @seed
|
|
|
|
%section= render 'facts', seed: @seed
|
|
|
|
- unless @seed.description.blank?
|
|
= cute_icon
|
|
.card.seed--description
|
|
.card-header
|
|
%h2 Notes
|
|
.card-body
|
|
:markdown
|
|
#{strip_tags markdownify(@seed.description)}
|
|
|
|
- if current_member
|
|
- if @seed.tradable && current_member != @seed.owner
|
|
%p= link_to "Request seeds",
|
|
new_message_path(recipient_id: @seed.owner.id,
|
|
subject: "Interested in your #{@seed.crop} seeds"),
|
|
class: 'btn btn-primary'
|
|
- else
|
|
= render 'shared/signin_signup', to: 'request seeds'
|
|
|
|
%section.plantings
|
|
= render 'seeds/descendants', seed: @seed
|
|
%section.seed-photos
|
|
- @photos.each do |photo|
|
|
= render 'photos/hero', photo: photo
|
|
|
|
.col-md-3.col-12
|
|
= render 'seeds/owner'
|
|
= render @seed.crop
|