<commit_before>- content_for(:body_extras) do
  | itemscope itemtype="http://schema.org/Photograph"

- content_for(:meta) do
  - cache([@photograph, :meta]) do
    -# OpenGraph
    meta property="og:type" content="website"
    meta property="og:image" content=image_url(@photograph.large_image)
    meta property="og:image:type" content="image/jpeg"
    meta property="og:url" content=photograph_url(@photograph, host: ENV['DOMAIN'])

    - if @photograph.metadata.title.present?
      meta property="og:title" content=(@photograph.metadata.title)
    - else
      meta property="og:title" content=t("untitled")

    - if @photograph.metadata.description.present?
      meta property="og:description" content=(@photograph.metadata.description)

    -# Twitter
    meta name="twitter:card" content="photo"
    meta name="twitter:image" content=image_url(@photograph.large_image)
    meta name="twitter:url" content=photograph_url(@photograph, host: ENV['DOMAIN'])

    - if @photograph.metadata.title.present?
      meta name="twitter:title" content=(@photograph.metadata.title)
    - else
      meta name="twitter:title" content=""

    - if @photograph.metadata.description.present?
      meta name="twitter:description" content=(truncate(@photograph.metadata.description, length: 200))

section id="photographs-show"
  section class="row"
    article class="large-9 small-12 columns"
      section class="display"
        = hidden_image_meta_tag(@photograph.large_image)

        div class="image"
          - if @photograph.has_precalculated_sizes?
            = photo_tag @photograph, :large
          - else
            - if @photograph.landscape?
              = photo_tag @photograph, "1500x"
            - elsif @photograph.portrait?
              = photo_tag @photograph, "x1000"
            - else
              = photo_tag @photograph, "1500x1500>"

          = interactions_for @photograph

          - cache([@photograph, @photograph.metadata, :description]) do
            - if @photograph.metadata.has_text?
              aside class="description"
                h4 itemprop="name"
                  = @photograph.metadata.title

                - if @photograph.metadata.description.present?
                  div itemprop="description"
                    = md @photograph.metadata.description

              div class="clear"

        - if @photograph.comments_enabled?
          = render @photograph.comment_threads

    aside id="photographs-sidebar" class="large-3 small-12 columns"
      - if user_signed_in? && current_user == @photograph.user && !sharing_mode
        = link_to t("photographs.edit"), edit_account_photograph_path(@photograph), class: "button secondary expand"

      = creator_details_for @photograph

      div class="panel share"
        h5= t("photographs.share.title")

        div class="share-url"
          label for="share-url"
            = t("photographs.share.blurb")<commit_msg>A few more fixes for caching<commit_after>- content_for(:body_extras) do
  | itemscope itemtype="http://schema.org/Photograph"

- content_for(:meta) do
  - cache([@photograph, :meta]) do
    -# OpenGraph
    meta property="og:type" content="website"
    meta property="og:image" content=image_url(@photograph.large_image)
    meta property="og:image:type" content="image/jpeg"
    meta property="og:url" content=photograph_url(@photograph, host: ENV['DOMAIN'])

    - if @photograph.metadata.title.present?
      meta property="og:title" content=(@photograph.metadata.title)
    - else
      meta property="og:title" content=t("untitled")

    - if @photograph.metadata.description.present?
      meta property="og:description" content=(@photograph.metadata.description)

    -# Twitter
    meta name="twitter:card" content="photo"
    meta name="twitter:image" content=image_url(@photograph.large_image)
    meta name="twitter:url" content=photograph_url(@photograph, host: ENV['DOMAIN'])

    - if @photograph.metadata.title.present?
      meta name="twitter:title" content=(@photograph.metadata.title)
    - else
      meta name="twitter:title" content=""

    - if @photograph.metadata.description.present?
      meta name="twitter:description" content=(truncate(@photograph.metadata.description, length: 200))

section id="photographs-show"
  section class="row"
    article class="large-9 small-12 columns"
      section class="display"
        = hidden_image_meta_tag(@photograph.large_image)

        div class="image"
          - if @photograph.has_precalculated_sizes?
            = photo_tag @photograph, :large
          - else
            - if @photograph.landscape?
              = photo_tag @photograph, "1500x"
            - elsif @photograph.portrait?
              = photo_tag @photograph, "x1000"
            - else
              = photo_tag @photograph, "1500x1500>"

          - unless sharing_mode
            = interactions_for @photograph

          - cache([@photograph, @photograph.metadata, :description]) do
            - if @photograph.metadata.has_text?
              aside class="description"
                h4 itemprop="name"
                  = @photograph.metadata.title

                - if @photograph.metadata.description.present?
                  div itemprop="description"
                    = md @photograph.metadata.description

              div class="clear"

        - if @photograph.comments_enabled? && !sharing_mode
          = render @photograph.comment_threads

    aside id="photographs-sidebar" class="large-3 small-12 columns"
      - if user_signed_in? && current_user == @photograph.user && !sharing_mode
        = link_to t("photographs.edit"), edit_account_photograph_path(@photograph), class: "button secondary expand"

      = creator_details_for @photograph

      div class="panel share"
        h5= t("photographs.share.title")

        div class="share-url"
          label for="share-url"
            = t("photographs.share.blurb")
{'fraction_non_alphanumeric': 0.12074198988195615, 'fraction_numerical': 0.009106239460370995, 'mean_word_length': 2.861328125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5983925', 'n_tokens_mistral': 1841, 'n_tokens_neox': 1659, 'n_words': 315}