XhtmlLink

Ecng.Net.Sitemap

Represents an XHTML link element for sitemap alternate language pages (hreflang). Used to specify alternate language versions of the same content for multilingual websites.

Constructors

XhtmlLink
public XhtmlLink(string href, string hreflang)
xhtmlLink = XhtmlLink(href, hreflang)

Initializes a new instance of the XhtmlLink class.

href
The URL of the alternate language version.
hreflang
The language code for this alternate version (e.g., "en", "fr", "en-US", "x-default").

Properties

Href
public string Href { get; }
value = xhtmlLink.Href

Gets the URL of the alternate language version. This URL must be absolute and properly formatted.

Hreflang
public string Hreflang { get; }
value = xhtmlLink.Hreflang

Gets the language code for this alternate version. Valid values include ISO 639-1 language codes (e.g., "en", "fr"), regional language codes (e.g., "en-US", "fr-CA"), and the special value "x-default" for the default language version.

Rel
public string Rel { get; }
value = xhtmlLink.Rel

Gets the relationship type for this link. Always returns "alternate" for XHTML sitemap links.

Methods

Equals
public override bool Equals(object obj)
result = xhtmlLink.Equals(obj)

Determines whether the specified object is equal to the current object. Two XhtmlLink objects are considered equal if they have the same Hreflang value.

obj
The object to compare with the current object.

Returns: true if the specified object is equal to the current object; otherwise, false.

GetHashCode
public override int GetHashCode()
result = xhtmlLink.GetHashCode()

Returns a hash code for this instance.

Returns: A hash code for this instance.

ToString
public override string ToString()
result = xhtmlLink.ToString()

Returns a string representation of this XHTML link.

Returns: A string in the format "hreflang: href".