angus
(Angus McLeod)
2023 年 10 月 24 日午前 12:42
7
Discourse の埋め込み投稿にある「投稿全体を表示」ボタンは、ユーザーがクリックしたときに埋め込まれたウェブページを「再クロール」することで機能するため、このようになっています。そのボタンをクリックしたときに表示される HTML は、投稿が公開されたときに WP Discourse プラグインによって送信されるのではなく、関連ページの新しいクロールです。
ウェブクロールは、HTML 構造の多様性 (たとえば、HTML で画像を表示する方法は数多くあります) のため、常に一長一短です。このため、改善の可能性がある機能として検討されています。詳細は以下をご覧ください。
I was reminded of this today after clicking the “Show Full Post” button for Introducing Discourse AI . The full post that is displayed on Discourse is missing all images and many headings. Adding to the confusion, image captions are displayed, but without their associated images.
It might be possible to fix the issue on Meta for its (Ghost?) blog by adjusting Meta’s allowed embed selectors site setting: Configure the Allowed Embed Selectors Setting . From past experience, I know that getting this…
そのため、現時点では簡単な解決策はありません。クローラーが使用する HTML セレクターをブロックおよび許可することはできますが、これは意図したとおりに機能させるのが難しいことです。詳細は以下をご覧ください。
Thanks for explaining Kevin. There are no settings specifically directed at this issue, but there’s two ways you could approach this.
Customize what HTML is pulled from your site
The way embeds work is that they scrape the content from a site using the Readability gem. The gem and it’s output use the following options to filter what HTML is scraped
opts[:whitelist] = SiteSetting.allowed_embed_selectors if SiteSetting.allowed_embed_selectors.present?
opts[:blacklist] = SiteSetting.blocked_embe…
これに対処する簡単な方法は、「投稿全体を表示」ボタンを非表示にするか、カスタムテーマコンポーネントを使用して元の WordPress 投稿にリンクするようにオーバーライドすることです。あなたのサイトのように、画像を含む比較的複雑な投稿 HTML 構造を持つサイトでは、これらの後者のオプションをお勧めします。
「いいね!」 1