Embedding Post: Can't read CSS Selectors from React Site

I have CSS tags on my content and have identified the CSS Selectors in the embedding admin settings but they are not being picked up by the crawler. I believe it is because my site is built with React and the css selectors are not accessible. How can I use this feature with a React site?

그럴 수도 있지만, Discourse가 해당 사이트로 보내는 요청에는 HTML이 반환되어야 한다고 예상합니다. 확인해 볼 다른 사항으로는, Discourse가 외부 사이트에서 가져온 내용을 10분 동안 캐시한다는 점입니다. 이는 allowed embed selectors 사이트 설정을 조정하는 경우, 새로운 설정 값의 결과를 확인하려면 최대 10분까지 기다려야 함을 의미합니다.

Discourse 사이트가 아직 프로덕션 환경이 아니고 Discourse 사이트의 Rails 콘솔에 접근할 수 있다면, Rails.cache.clear 명령어를 사용하여 콘솔에서 캐시를 삭제할 수 있습니다.

해당 설정에 대한 추가 세부 사항은 여기에 있습니다: Configuring allowed embed selectors.

수정: 임베딩이 예상대로 작동하고 있다고 _생각_합니다. 다만 일부 사이트에서는 설정이 까다로운 것 같습니다. 이 주제를 #support로 이동할 것입니다.

몇 달 전에 임베디드 포스트를 파싱하는 더 나은 방법을 Discourse가 찾아야 한다고 제안하는 Contribute > Feature 주제를 생성한 적이 있습니다: Topic embedding needs some love. 다른 사람이 먼저 하지 않는 한, 곧 이 작업에 시간을 투자할 예정입니다.

Discourse presents a different view to crawlers. To see it you’ll need to visit with javascript turned off.

I would not expect embedded posts to be crawled since they do not exist on the site where they are embedded.

Hello, I’m referring to how Discourse crawls my React site with the embedded posts feature. I’m having a hard time telling it what content to include on the Discourse post because of how it sees my React page.

It it helps, the code that’s used for pulling in the external post is here: discourse/app/models/topic_embed.rb at main · discourse/discourse · GitHub

If you have access to your site’s Rails console, you can test it to get some idea of what’s going on. For example:

TopicEmbed.find_remote("https://blog.discourse.org/2023/04/introducing-discourse-ai/")

Where I’ve run into problems is with the parse_html method that’s called at the end of the find_remote method. Ruby Readability struggles with some HTML/CSS.

It’s also possible that HTML isn’t being returned from your React site. You could confirm that by running the code that’s in the find_remote method in steps from the console.

This is excellent, thank you!