| markcz 2006-12-12, 7:25 am |
| Hallo Ninerfan,
Base metatag is inserted By RobotMetatag CMS control, to override
default behaviour create your own where you could not write your base
tag. But, this is by default for override paths used by cms and I am
not sure everything will work then.
You need to include your control on all your pages.
bye, Martin
Here is our custom robotmetatag:
using Microsoft.ContentManagement.WebControls;
using Microsoft.ContentManagement.Common;
using Microsoft.ContentManagement.Publishing;
namespace MDCRInternet.CMSExtensionPack.UserControls
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for W3CRobotMetatag.
/// </summary>
public partial class W3CRobotMetatag : UserControl
{
private bool renderBaseHref = true;
private const string Index = "INDEX";
private const string Follow = "FOLLOW";
private const string noIndex = "NOINDEX";
private const string noFollow = "NOFOLLOW";
public W3CRobotMetatag()
{
}
public bool RenderBaseHref
{
get { return this.renderBaseHref; }
set { this.renderBaseHref = value; }
}
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
ChannelItem currentItem = CmsHttpContext.Current.ChannelItem;
if( currentItem != null )
{
string followKey = (currentItem.IsRobotFollowable)?Follow:noFollow;
string indexKey = (currentItem.IsRobotIndexable)?Index:noIndex;
// write out robot meta tag
writer.Write("<META name=\"ROBOTS\"
content=\""+followKey+","+indexKey+"\" >\n");
if( this.RenderBaseHref )
{
string urlString = Server.HtmlEncode(
Page.Request.Url.AbsoluteUri);
writer.Write("<BASE href=\""+ urlString+"\" >");
}
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//this.Load += new System.EventHandler(this.Page_Load);
//this.rptProgrammArchive.ItemDataBound += new
System.Web.UI.WebControls.RepeaterItemEventHandler(this.Repeater_ItemDataBound
);
}
#endregion
}
}
Ninerfan napsal:
> Hi all,
>
> Our MSCMS is inserting an "extra" <Base> tag into our templated pages. This
> tag is showing up first before the <Base> tag inserted by our own template
> header control code. The developers are stumped because they say they can't
> find any code that creates that first base tag. This leaves us all wondering
> if there is some sort of configuratin or default behavior somewhere in CMS
> that will create a base tag.
>
> Our site has not been viewable or our links clickable by anyone using IE 7
> since mid November. Here is an example of our header HTML with the two base
> tags.
>
> <HTML><HEAD>
> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
> <meta content="C#" name="CODE_LANGUAGE">
> <meta content="JavaScript" name="vs_defaultClientScript">
> <meta content="http://schemas.microsoft.com/intellisense/ie5"
> name="vs_targetSchema">
> <meta name="ROBOTS" content="FOLLOW,INDEX">
> <base
> href="http://www.hnfs.net:81/hnfs/Templates/FourPaneTemplateA.aspx?NRMODE=Published&NRNODEGUID=%7b608448BB-A27C-4B5C-8EAF-30A06AC308A7%7d&NRORIGINALURL=%2fbene%2fhome%2f&NRCACHEHINT=Guest">
>
> <span><base href=https://www.hnfs.net/hnfs/Templates/></span>
> <title>TRICARE - Health Net Federal Services Beneficiary Home
> Page</title><meta name="description" content="This is the beneficiary home
> page for Health Net Federal Services."/><meta name="keywords"
> content="tricare, healthnet, health net, federal
> services,HNFS,community,events,briefings
,forms,bulletins"/>
> <link href="../css/styles.css" type="text/css" rel="stylesheet">
> </HEAD>
>
> Can anyone tell me where this first base tag is coming from and how we can
> turn it off or manipulate it's values?
>
> Many thanks.
|