问题描述
我在墙纸站点的每个页面上都有一个喜欢的按钮.有一个选项可以编辑墙纸的标题.因此,页面的URL也会发生变化,就像它在Stack Overflow中一样.在Stack Overflow中,当问题标题更改时,旧的URL会永久重定向到新的URL.在我的站点中实现了相同的逻辑.
I have a like button on each page in a wallpaper site. There is an option to edit the title of the wallpaper. Hence, the URL of the page changes as well, like it happens in Stack Overflow. In Stack Overflow, when the title of the question changes, the old URL is redirected permanently to the new URL. The same logic is implemented in my site.
问题是,例如墙纸页面是否有10个赞
The problem is, say if there are 10 likes for a wallpaper page
如果标题稍微更改为新标题",则URL更改为
If the title is changed slightly to 'new title', the URL changes to
在新页面中,喜欢"计数变为0.有没有一种方法可以使喜欢"按钮检测到301重定向.
In the new page, the like count becomes 0. Is there a way to make the Like button detect 301 redirection.
推荐答案
赞"按钮使用og:url标记.在新页面上,您需要保留旧的og:url值.
The like button uses the og:url tag. On your new page you need to keep the old og:url value.
这篇关于如何管理可能略有变化的网址的“赞"按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!