リテラルとプレース ホルダーを使用して、説明やキーワードなどのメタ タグを追加できるマスター ページを実装しようとしています。次のコードを使用しています。
Just for further info:
" is used for double quotes
/ is slash (/)
<!-- description in master page -->
<asp:Literal ID="descriptionStart" runat="server" Text="<meta name="description" content="test" />
<asp:ContentPlaceHolder ID="metaDescription" runat="server" />
<asp:Literal ID="descriptionEnd" runat="server" Text="" />"/>
<!-- end of description -->
In my content page I add description as follows:
<asp:Content ID="metaDescription" ContentPlaceHolderID="metaDescription" runat="server">
This is a test description
</asp:Content>
IE View code shows this:
<!-- description in master page -->
<meta name="description" content="
This is a test description
" />
<!-- end of description -->
ASP.Net がリトラルに改行を追加しているようです。説明をメタ説明タグと同じ行に表示することはできますか?
Based on one comment I received Alexander, I modified the code for master page. It's enclosing placeholder in single quotes.
<!-- description -->
<meta name="description" content='<asp:ContentPlaceHolder ID="metaDescription" runat="server" />' />
<!-- end of description -->
Here is the output of IE view code after the change:
<!-- description -->
<meta name="description" content='This is a test description' />
<!-- end of description -->