添加规范标签到我的网页搜索引擎优化通过代码后面? [英] Adding the CANONICAL tag to my page for SEO through code behind?

查看:145
本文介绍了添加规范标签到我的网页搜索引擎优化通过代码后面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET与MasterPages。因此我不能只是放在我的网页引用我的母版此链接

I am using ASP.NET with MasterPages. Thus i cant just place this link in my pages that reference my MasterPage.

<link rel="canonical" href="http://www.erate.co.za/" />



我需要把这个环节中,虽然我的网页中的每一个网页的加载。我将如何做到这一点通过代码?我使用VB.NET,但C#也将帮助我在正确的方向。

I need to place this link in though my Page Load of each one of my pages. How would i do this through code? I am using VB.NET but C# will also help me in the right direction.

这是我做到了在我的背后我的代码description标签。

This is how i did it for my DESCRIPTION tag in my code behind.

    Dim tag As HtmlMeta = New HtmlMeta()
    tag.Name = "description"
    tag.Content = "Find or rate any company in South Africa for FREE and rate them"
    Header.Controls.Add(tag)

在此先感谢!

推荐答案

这是我必须做的......... .........

This is what i had to do..................

    Dim seoTag As HtmlLink = New HtmlLink()
    seoTag.Attributes.Add("rel", "canonical")
    seoTag.Href = "http://www.erate.co.za/"
    Header.Controls.Add(seoTag)

更多信息这里

这篇关于添加规范标签到我的网页搜索引擎优化通过代码后面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆