Update account, status meta tags

• Update:
- account, status meta tags
This commit is contained in:
mgabdev 2020-05-26 20:12:19 -04:00
parent 7483c1de2c
commit 8d6d85f829
39 changed files with 49 additions and 69 deletions

View File

@ -15,8 +15,9 @@ class ReactController < ApplicationController
def set_data_for_meta
return if find_route_matches
if request.path.starts_with?('/tags') && params[:tag].present?
@tag = Tag.find_normalized(params[:tag])
if request.path.count("/") == 1 && !request.path.include?("@")
acctFromPath = request.path.sub("/", "")
@account = Account.find_local!(acctFromPath)
end
end
@ -31,7 +32,7 @@ class ReactController < ApplicationController
end
def find_route_matches
request.path.match(/\A\/(home|groups|lists|notifications|explore|follow_requests|blocks|domain_blocks|mutes)/)
request.path.match(/\A\/(home|group|groups|list|lists|notifications|explore|search|tags|compose|follow_requests|admin|account|settings|filters|timeline|blocks|domain_blocks|mutes)/)
end
def set_initial_state_json

View File

@ -65,24 +65,7 @@ module StreamEntriesHelper
end
def account_description(account)
prepend_str = [
[
number_to_human(account.statuses_count, strip_insignificant_zeros: true),
I18n.t('accounts.posts', count: account.statuses_count),
].join(' '),
[
number_to_human(account.following_count, strip_insignificant_zeros: true),
I18n.t('accounts.following', count: account.following_count),
].join(' '),
[
number_to_human(account.followers_count, strip_insignificant_zeros: true),
I18n.t('accounts.followers', count: account.followers_count),
].join(' '),
].join(', ')
[prepend_str, account.note].join(' · ')
return "The latest Gabs from #{display_name(account)} (@#{account.username}). #{account.note}"
end
def media_summary(status)
@ -113,7 +96,7 @@ module StreamEntriesHelper
status.preloadable_poll.options.map { |o| "[ ] #{o}" }.join("\n")
end
def status_description(status)
def status_description(status, account)
components = [[media_summary(status), status_text_summary(status)].reject(&:blank?).join(' · ')]
if status.spoiler_text.blank?
@ -121,7 +104,7 @@ module StreamEntriesHelper
components << poll_summary(status)
end
components.reject(&:blank?).join("\n\n")
return "#{display_name(account)} (@#{account.username}) on Gab. #{components.reject(&:blank?).join("\n\n")}"
end
def stream_link_target

View File

@ -1,9 +1,7 @@
- content_for :page_title do
= "#{display_name(account)} (@#{account.local_username_and_domain}) | #{site_hostname}"
= "#{display_name(account)} (@#{account.username}) • #{site_hostname}"
- content_for :header_tags do
%meta{ name: 'description', content: account_description(account) }/
- if account.user&.setting_noindex
%meta{ name: 'robots', content: 'noindex' }/
@ -12,10 +10,10 @@
%link{ rel: 'alternate', type: 'application/rss+xml', href: account_url(account, format: 'rss') }/
%link{ rel: 'alternate', type: 'application/activity+json', href: ActivityPub::TagManager.instance.uri_for(account) }/
= opengraph 'og:type', 'profile'
= render 'accounts/og', account: account, url: short_account_url(account, only_path: false)
- if older_url
%link{ rel: 'next', href: older_url }/
- if newer_url
%link{ rel: 'prev', href: newer_url }/
= opengraph 'og:type', 'profile'
= render 'accounts/og', account: account, url: short_account_url(account, only_path: false)

View File

@ -4,7 +4,7 @@
= opengraph 'og:url', url
= opengraph 'og:site_name', site_title
= opengraph 'og:title', yield(:page_title).strip
= opengraph 'og:title', "#{display_name(account)} (@#{account.username}) • #{site_hostname}"
= opengraph 'og:description', description
= opengraph 'og:image', full_asset_url(account.avatar.url(:original))
= opengraph 'og:image:width', '120'

View File

@ -32,9 +32,7 @@
%meta{ name: 'apple-mobile-web-app-capable', content: 'yes' }/
%meta{ name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' }/
- if @tag
= render 'tags/meta', tag: @tag, initial_state_json: @initial_state_json
- elsif @stream_entry && @account
- if @stream_entry && @account
= render 'stream_entries/meta', stream_entry: @stream_entry, account: @account
- elsif @account && @account.local?
= render 'accounts/meta', account: @account, older_url: nil, newer_url: nil

View File

@ -1,5 +1,5 @@
- content_for :page_title do
= t('statuses.title', name: display_name(account), quote: truncate(stream_entry.activity.spoiler_text.presence || stream_entry.activity.text, length: 50, omission: '…', escape: false)) + " | #{site_hostname}"
= t('statuses.title', name: display_name(account), quote: truncate(stream_entry.activity.spoiler_text.presence || stream_entry.activity.text, length: 50, omission: '…', escape: false))
- content_for :header_tags do
- if account.user&.setting_noindex
@ -11,8 +11,8 @@
= opengraph 'og:site_name', site_title
= opengraph 'og:type', 'article'
= opengraph 'og:title', "#{display_name(account)} (@#{account.local_username_and_domain})"
= opengraph 'og:title', t('statuses.title', name: display_name(account), quote: truncate(stream_entry.activity.spoiler_text.presence || stream_entry.activity.text, length: 50, omission: '…', escape: false))
= opengraph 'og:url', short_account_status_url(account, stream_entry.activity)
= render 'stream_entries/og_description', activity: stream_entry.activity
= render 'stream_entries/og_description', activity: stream_entry.activity, account: account
= render 'stream_entries/og_image', activity: stream_entry.activity, account: account

View File

@ -1,4 +1,4 @@
- description = status_description(activity)
- description = t('statuses.title', name: display_name(account), quote: truncate(activity.spoiler_text.presence || activity.text, length: 50, omission: '…', escape: false))
%meta{ name: 'description', content: description }/
= opengraph 'og:description', description

View File

@ -900,7 +900,7 @@ ca:
vote: Vota
show_more: Mostrar més
sign_in_to_participate: Inicia la sessió per participar a la conversa
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Només seguidors
private_long: Mostra només als seguidors

View File

@ -899,7 +899,7 @@ co:
vote: Vutà
show_more: Vede di più
sign_in_to_participate: Cunnettatevi per participà à a cunversazione
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Solu per labbunati
private_long: Mustrà solu à labbunati

View File

@ -842,7 +842,7 @@ cy:
reblog: Ni ellir pinio bŵstiau
show_more: Dangos mwy
sign_in_to_participate: Mengofnodwch i gymryd rhan yn y sgwrs
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Dilynwyr yn unig
private_long: Dangos i ddilynwyr yn unig

View File

@ -722,7 +722,7 @@ da:
reblog: Fremhævede trut kan ikke fastgøres
show_more: Vis mere
sign_in_to_participate: Log ind for at deltage i samtalen
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Kun-følgere
private_long: Vis kun til følgere

View File

@ -900,7 +900,7 @@ de:
vote: Abstimmen
show_more: Mehr anzeigen
sign_in_to_participate: Melde dich an, um an der Konversation teilzuhaben
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Nur Folgende
private_long: Nur für Folgende sichtbar

View File

@ -881,7 +881,7 @@ el:
vote: Ψήφισε
show_more: Δείξε περισσότερα
sign_in_to_participate: Εγγράφου για να συμμετάσχεις στη συζήτηση
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Μόνο ακόλουθοι
private_long: Εμφάνιση μόνο σε ακόλουθους

View File

@ -931,7 +931,7 @@ en:
vote: Vote
show_more: Show more
sign_in_to_participate: Sign in to participate in the conversation
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Followers-only
private_long: Only show to followers

View File

@ -876,7 +876,7 @@ en_GB:
vote: Vote
show_more: Show more
sign_in_to_participate: Sign in to participate in the conversation
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Followers-only
private_long: Only show to followers

View File

@ -891,7 +891,7 @@ eo:
vote: Voĉdoni
show_more: Montri pli
sign_in_to_participate: Ensaluti por partopreni en la konversacio
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Montri nur al sekvantoj
private_long: Montri nur al sekvantoj

View File

@ -727,7 +727,7 @@ es:
reblog: Un repost no puede fijarse
show_more: Mostrar más
sign_in_to_participate: Regístrate para participar en la conversación
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Sólo mostrar a seguidores
private_long: Solo mostrar a tus seguidores

View File

@ -804,7 +804,7 @@ eu:
reblog: Bultzada bat ezin da finkatu
show_more: Erakutsi gehiago
sign_in_to_participate: Eman izena elkarrizketan parte hartzeko
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Jarraitzaileak besterik ez
private_long: Erakutsi jarraitzaileei besterik ez

View File

@ -882,7 +882,7 @@ fa:
vote: رأی
show_more: نمایش
sign_in_to_participate: برای شرکت در گفتگو وارد حساب خود شوید
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: خصوصی
private_long: تنها پیگیران شما می‌بینند

View File

@ -877,7 +877,7 @@ gl:
vote: Votar
show_more: Mostrar máis
sign_in_to_participate: Conéctese para participar na conversa
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Só seguidoras
private_long: Mostrar só as seguidoras

View File

@ -543,7 +543,7 @@ hu:
private: Csak publikus tülköt tűzhetsz ki
reblog: Reblogolt tülköt nem tudsz kitűzni
show_more: Mutass többet
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Csak követőknek
private_long: A tülk csak követőidnek jelenik meg

View File

@ -899,7 +899,7 @@ ja:
vote: 投票
show_more: もっと見る
sign_in_to_participate: ログインして会話に参加
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: フォロワー限定
private_long: フォロワーにのみ表示されます

View File

@ -693,7 +693,7 @@ ka:
reblog: ბუსტი ვერ აიპინება
show_more: მეტის ჩვენება
sign_in_to_participate: საუბარში მონაწილეობისთვის გაიარეთ ავტორიზაცია
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: მხოლოდ-მიმდევრები
private_long: აჩვენე მხოლოდ მიმდევრებს

View File

@ -819,7 +819,7 @@ kk:
vote: Дауыс беру
show_more: Тағы әкел
sign_in_to_participate: Сұхбатқа қатысу үшін кіріңіз
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Тек оқырмандарға
private_long: Тек оқырмандарға ғана көрінеді

View File

@ -902,7 +902,7 @@ ko:
vote: 투표
show_more: 더 보기
sign_in_to_participate: 로그인 하여 이 대화에 참여하기
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: 비공개
private_long: 팔로워에게만 공개됩니다

View File

@ -820,7 +820,7 @@ lt:
reblog: Pakeltos žinutės negali būti prisegtos
show_more: Daugiau
sign_in_to_participate: Prisijunkite jeigu norite dalyvauti pokalbyje
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Tik sekėjams
private_long: Rodyti tik sekėjams

View File

@ -900,7 +900,7 @@ nl:
vote: Stemmen
show_more: Meer tonen
sign_in_to_participate: Meld je aan om aan dit gesprek mee te doen
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Alleen volgers
private_long: Alleen aan jouw volgers tonen

View File

@ -543,7 +543,7 @@
private: Kun offentlige tuter kan festes
reblog: En fremheving kan ikke festes
show_more: Vis mer
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Privat
private_long: Synlig kun for følgere

View File

@ -919,7 +919,7 @@ pl:
vote: Głosuj
show_more: Pokaż więcej
sign_in_to_participate: Zaloguj się, aby udzielić się w tej konwersacji
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Tylko dla śledzących
private_long: Widoczne tylko dla osób, które Cię śledzą

View File

@ -900,7 +900,7 @@ pt-BR:
vote: Votar
show_more: Mostrar mais
sign_in_to_participate: Entre para participar dessa conversa
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Apenas seguidores
private_long: Mostrar apenas para seguidores

View File

@ -822,7 +822,7 @@ pt:
vote: Votar
show_more: Mostrar mais
sign_in_to_participate: Inicie a sessão para participar na conversa
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Mostrar apenas para seguidores
private_long: Mostrar apenas para seguidores

View File

@ -930,7 +930,7 @@ ru:
vote: Голосовать
show_more: Ещё
sign_in_to_participate: Войдите, чтобы принять участие в дискуссии
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Для подписчиков
private_long: Показывать только подписчикам

View File

@ -801,7 +801,7 @@ sq:
reblog: Smund të fiksohet një përforcim
show_more: Shfaq më tepër
sign_in_to_participate: Bëni hyrjen, që të merrni pjesë te biseda
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Vetëm ndjekësve
private_long: Shfaqua vetëm ndjekësve

View File

@ -533,7 +533,7 @@ sr-Latn:
private: Tutovi koji nisu javni ne mogu da se prikače
reblog: Podrška ne može da se prikači
show_more: Prikaži još
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Samo pratioci
private_long: Samo prikaži pratiocima

View File

@ -820,7 +820,7 @@ sr:
reblog: Подршка не може да се прикачи
show_more: Прикажи још
sign_in_to_participate: Пријавите се да учествујете у разговору
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Само пратиоци
private_long: Прикажи само пратиоцима

View File

@ -624,7 +624,7 @@ sv:
private: Icke-offentliga toot kan inte fästas
reblog: Knuffar kan inte fästas
show_more: Visa mer
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Endast följare
private_long: Visa endast till följare

View File

@ -607,7 +607,7 @@ th:
other: "%{count} การลงคะแนน"
show_more: แสดงเพิ่มเติม
sign_in_to_participate: ลงชื่อเข้าเพื่อเข้าร่วมการสนทนา
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: ผู้ติดตามเท่านั้น
private_long: แสดงต่อผู้ติดตามเท่านั้น

View File

@ -666,7 +666,7 @@ uk:
private: Не можна закріпити непублічний пост
reblog: Не можна закріпити просунутий пост
show_more: Детальніше
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: Для підписників
private_long: Показувати тільки підписникам

View File

@ -684,7 +684,7 @@ zh-TW:
private: 不能置頂非公開的嘟文
reblog: 不能置頂轉嘟
show_more: 顯示更多
title: '%{name}: "%{quote}"'
title: "%{name} on Gab: '%{quote}'"
visibilities:
private: 僅關注者
private_long: 只有關注你的人能看到