Ok, see if anyone has a better idea here…
In my page library I have a custom field called MetaTitle
In my .master page, I’ve got the following placeholder in the <head> tag:
<asp:ContentPlaceHolder id=”ieMetaTitle” runat=”server” />
In my Page I have the following in the <asp:Content ContentPlaceHolderID=”ieMetaTitle” runat=”server”>
<asp:Literal  runat=”server” Text=”<meta name=’title’ content='”/><SharePoint:ListItemProperty Property=”MetaTitle” id=”MetaTitle” runat=”server”/><asp:Literal runat=”server” Text=”‘ >”/>
So, every time I put the three lines together on the same line and save the first time the meta tag renders fine all on one line, but then SPD puts each element on a seperate line. So, first time it’s saved it looks like this in the source code:
<meta name=’title’ content=’MetaTitle Data’ >
Then I make some changes, and save it again and it looks like this in the rendered page:
<meta name=’title’ content=’
MetaTitle Data
‘ >
Is there any way I can tell SPD to keep these three lines together?
Â
Well, I wasn’t able to stop SPD from reformatting for page layouts or pages themselves with this, but as it turns out it seems like you can break out the meta onto different lines and still be ok, but it just looks damn ugly, so nobody peak under the covers.
I did manage to accomplish what I wanted, which was adding the SEO meta tags to the pages, but took a different approach. It seems SPD is much more forgiving (or forgetful) of reformatting code in a .master page, so I stuck my stuff in there and at this point I don’t think there are issues with it – or at least “It appears to work”.
Wrote it up and posted here: http://iedaddy.com/2014/01/sharepoint-2010-meta-tags-for-search-engine-optimization-seo-open-graph-and-twitter-cards/
Â