对于这个问题的公然无知,我深表歉意,但我被指控在 Django 中修复一些我没有经验的东西!
我们遇到了 URL 和重复内容的问题。
如果我们访问“www.hello.com/services/”,那么我们会呈现整个页面,非常好。
如果我们访问“www.hello.com/services”,那么我们会得到相同的内容,但默认值似乎设置在一行中:
class PageTitleNode(template.Node):?
?
def render(self, context):?
try:?
meta_info = MetaInfo.objects.get(url=context['request'].path)?
except ObjectDoesNotExist:?
return u'This is our default page title'?
return u"%s - hello.com" % meta_info.title
这样做的主要问题是谷歌正在索引两个几乎相同的页面,根据我们客户多付的在线战略合作伙伴的说法,这是糟糕的 SEO 。
我知道这很模糊,但是如果有人可以提供帮助,那么将会非常高兴。
谢谢阅读!