Page.MetaDescription Page.MetaDescription Page.MetaDescription Page.MetaDescription Property

定義

取得或設定 "description" meta 項目的內容。Gets or sets the content of the "description" meta element.

public:
 property System::String ^ MetaDescription { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
public string MetaDescription { get; set; }
member this.MetaDescription : string with get, set
Public Property MetaDescription As String

屬性值

"description" meta 項目的內容。The content of the "description" meta element.

例外狀況

頁面沒有標頭控制項 (head 屬性設為「server」的 runat 項目)。The page does not have a header control (a head element with the runat attribute set to "server").

範例

如果您將頁面MetaDescription的屬性設定為「ASP.NET 總覽」,下列元素會出現在轉譯的 HTML 中:If you set the MetaDescription property of a page to "ASP.NET Overview", the following element will appear in the rendered HTML:

<meta name="description" content="ASP.NET Overview" />

備註

HTML meta專案可以用來改善搜尋引擎清單。HTML meta elements can be used to improve search-engine listings. 某些搜尋引擎會meta使用 "description" 元素來改善清單預覽。The "description" meta element is used by some search engines to improve listing previews.

如果頁面標記的meta head專案中沒有 "description" 元素,當呈現頁面時, meta會將專案加入至頁面。If there is no "description" meta element in the head element of the page markup, the meta element is added to the page when the page is rendered. 如果頁面標記已經有 "description" meta元素,這個屬性會取得或content設定專案的屬性metaIf the page markup already has a "description" meta element, this property gets or sets the content attribute of the meta element.

您也可以在@ Page指示詞中設定這個屬性。You can also set this property in the @ Page directive.

適用於

另請參閱