简体   繁体   English

Facebook sharer和prerender.io(在angularjs应用程序中)

[英]Facebook sharer and prerender.io (in an angularjs app)

I've just setup prerender.io middlewave into my tomcat server (running some java webservices and an angularjs app). 我刚刚将prerender.io middlewave设置到我的tomcat服务器中(运行一些java webservices和一个angularjs应用程序)。

The service (prerender) works as it should and I can see the pages adding to the list (also when I send a request simulation the user agent). 服务(prerender)工作正常,我可以看到页面添加到列表中(当我发送请求模拟用户代理时)。

My problem is with the Facebook share button (from addthis). 我的问题是Facebook分享按钮(来自addthis)。

Basically if I visit a not yet cached page and click the "Share on Facebook" button, it will show me the angularjs template and not the "rendered" one. 基本上,如果我访问一个尚未缓存的页面并单击“在Facebook上共享”按钮,它将显示angularjs模板而不是“渲染”模板。

The strange thing is that I then can see the page on Prerender.io admin. 奇怪的是,我可以在Prerender.io admin上看到该页面。

It's like it's too slow and it times out. 它就像它太慢而且超时。 Still I don't know how it get the non-cached version of the page. 我仍然不知道如何获得页面的非缓存版本。

After the first wrong call Facebook caches the page so if I don't manually refresh it from the Facebook Object Debugger ( https://developers.facebook.com/tools/debug/og/object ) the wrong page will stay cached on FB servers until the FB cache is refreshed. 在第一次错误调用Facebook缓存页面后,如果我不从Facebook对象调试器( https://developers.facebook.com/tools/debug/og/object )手动刷新它,错误的页面将保持缓存在FB上服务器,直到刷新FB缓存。

Anyway has any suggestion on how to fix this? 无论如何有任何关于如何解决这个问题的建议?

I could pre-cache every page but I will have to deal with new pages and I don't think it's a nice solution. 我可以预先缓存每一页,但我将不得不处理新的页面,我不认为这是一个很好的解决方案。

thanks, Dem 谢谢,Dem

I have the same issue and it still bothers me a lot. 我有同样的问题,它仍然困扰我很多。

What you can do is after you create your page (typically your user save something), then you can create a server call to prerender to recache your page. 您可以做的是在创建页面后(通常是用户保存某些内容),然后您可以创建服务器调用以预先重新缓存页面。 After some time (for example 1 min) you can invoke an another call to facebook to refresh its cache... 一段时间后(例如1分钟),您可以调用另一个对Facebook的调用来刷新其缓存...

The only issue with this, it works only after couple of minutes... :( 这个唯一的问题,它只在几分钟后才有效...... :(

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM