MetaTags Collection

Microsoft FrontPage Visual Basic

MetaTags Collection

WebFile MetaTags

An array of property key/value pairs. Each item in the MetaTags collection represents a META tag contained on an HTML page in Microsoft FrontPage. There is no MetaTag object.

Note  META tags generated by FrontPage, such as META tags for a theme or border, won't show up in the MetaTags collection. The MetaTags collection is only propagated after the file is saved. For example, if you add a new META tag to a page by using the Code view or by programmatically using the Page object model in Microsoft Visual Basic for Applications, you won't be able to view the property key/value pairs until after you save the page. To save space in the META dictionary, you can use the following methods to disable the META tag store:

  • Set the DisableMetaTagStore key on a per-service basis
  • Set the DisableMetaTagStore key as a global setting under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\All Ports
  • Set the vti_disablemetatagstore property

The DisableMetaTagStore key functions in the same way as other server settings; see the Server Extensions Resource Kit for more information about server settings.

Using the MetaTags Collection

Use the MetaTags property to return the MetaTags collection.

Note  In the meta data for FrontPage, the http-equiv attribute can be used in place of the name attribute. FrontPage doesn't use the value of the http-equiv attribute in response message headers. The syntax for META data is as follows:

<META
CONTENT=description
HTTP-EQUIV=text
NAME=text
TITLE=text
URL=url
>
		

You can also return a list of the META tags that exist in the active Web site by accessing the file structure through the root folder of the ActiveWeb object, as shown in the following example.

Note  To run this example, create a form with a text box called txtMetaTags (set to multiple lines) and a command button called cmdGetMetaTagInfo, and then copy the example into the code window.

    Private Sub cmdGetMetaTagInfo_Click()
Dim myWeb As WebEx
Dim myFiles As WebFiles
Dim myFile As WebFile
Dim myMetaTags As MetaTags
Dim myMetaTag As Variant
Dim myFileName As String
Dim myMetaTagName As String
Dim myReturnInfo As String

Set myWeb = ActiveWeb
Set myFiles = myWeb.RootFolder.Files

With myWeb
    For Each myFile In myFiles
        Set myMetaTags = myFile.MetaTags
        For Each myMetaTag In myMetaTags
            myFileName = myFile.Name
            myMetaTagName = myMetaTag
            myReturnInfo = myFileName & ": " & myMetaTagName
            txtMetaTags.Text = txtMetaTags.Text & myReturnInfo
        Next
    Next
    txtMetaTags.SetFocus
    txtMetaTags.CurLine = 0
End With
End Sub
  

Use the Application property to return the Application object. The following statement returns the Application object.

    myApplication = ActiveWeb.RootFolder.Files(0).MetaTags. _ 
Application
  

Use the Count property to return the number of META elements in the collection. The following statement returns the number of META elements in the tenth file of the ActiveWeb object.

myMetaTagCount = ActiveWeb.RootFolder.Files(9).MetaTags.Count
		

Use Items(index), where index is the property key value as a string, of an item in the MetaTags collection to return the property key/value pair. The following example returns the program identification tag from the META tags in the first file of the ActiveWeb object.

myMetaTagOne = ActiveWeb.RootFolder.Files(0).MetaTags("ProgId")
		

Common property key values are "generator" and "progid." For more information about property key values, see the table in the Properties object.

Use the Parent property when you want to return the file container for the MetaTags collection. For example, the following example returns the Url property of the WebFile container object that is associated with the META tags for the first file of the ActiveWeb object.

myMetaTagParent = _
    ActiveWeb.RootFolder.Files(0).MetaTags.Parent.Url