在 Facebook 上共享具有基于位置的重定向的网站会显示不需要的名称和信息描述
我有一个网站,当您访问索引页面时,它将用户重定向到特定的本地子网站。
例如,当您访问 www.abc.com 时,我在服务器端运行“redirectCity()”函数。如果检测到城市,它会将用户引导至 www.abc.com/newyork。如果未检测到城市,它将引导用户访问 www.abc.com/city_picker。 www.abc.com/newyork 的元数据是为纽约用户设置的,www.abc.com/city_picker 的元数据被设计为通用的。
当我在 Facebook 上分享链接“www.abc.com”时,它返回“www.abc.com/newyork”网站的标题、描述和缩略图。
是否有一个优雅的解决方案可以让 Facebook 从“www.abc.com/city_picker”网站获取元数据?
提前致谢。
I have a website that redirects the user to a particular local subsite when you visit the index page.
For example, when you visit www.abc.com, I run a 'redirectCity()' function on the server side. If a city is detected, it directs the user to www.abc.com/newyork. If no city is detected, it directs the user to www.abc.com/city_picker. The meta data for www.abc.com/newyork is set for New York users, and the meta data for www.abc.com/city_picker is designed to be generic.
When I share the link 'www.abc.com' on Facebook, it's throwing me back the title, description and thumbnail for the 'www.abc.com/newyork' site.
Is there an elegant solution to have Facebook pick up the meta data from 'www.abc.com/city_picker' site instead?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新:
Facebook 使用特殊的用户代理。您可以检查此用户代理并显示通用页面(参考):
嗯,Facebook (基本上所有像样的网络爬虫)都会尝试以普通用户查看网站的方式查看您的网站。抓取您页面的 Facebook 服务器似乎位于纽约! :-)
你最好的选择是捕获 Facebook 正在从哪个 IP 访问你的网站并破例,现在我不会这样做。您可能想要推广您的 Facebook 粉丝页面,而不是指向“主页”的常规点赞插件。
UPDATE:
Facebook uses a special user agent. You can check for this user agent and show the generic page (reference):
Well, Facebook (and basically all decent Web crawlers) try to view your websites the way a normal user would view it. And it seems that Facebook server that is scraping your page is in NY! :-)
Your best bet is to capture from which IP Facebook is accessing your website and make an exception, now I wouldn't do this. You may want to promote your Facebook Fan Page instead of a regular Like Plugin pointing to the "Homepage".