Skip to content

Instantly share code, notes, and snippets.

@hishaamn
Last active August 30, 2023 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hishaamn/b97e8f8ce17c9d7a1b1f616ea17e71a2 to your computer and use it in GitHub Desktop.
Save hishaamn/b97e8f8ce17c9d7a1b1f616ea17e71a2 to your computer and use it in GitHub Desktop.
/////// FROM ///////
protected static XNamespace Xhtml { get; } = (XNamespace) "http://www.w3.org/1999/XMLSchema-instance";
protected virtual XElement BuildAlternateLinkElement(string href, string hreflang, string rel = "alternate") => new XElement(SitemapGenerator.Xhtml + "link", new object[3]
{
(object) new XAttribute((XName) nameof (rel), (object) rel),
(object) new XAttribute((XName) nameof (hreflang), (object) hreflang),
(object) new XAttribute((XName) nameof (href), (object) href)
});
/////// TO ///////
protected static XNamespace Xhtml { get; } = (XNamespace) "http://www.w3.org/2001/XMLSchema-instance";
protected virtual XElement BuildAlternateLinkElement(string href, string hreflang, string rel = "alternate") => new XElement(YourClassName.Xhtml + "link", new object[3]
{
(object) new XAttribute((XName) nameof (rel), (object) rel),
(object) new XAttribute((XName) nameof (hreflang), (object) hreflang),
(object) new XAttribute((XName) nameof (href), (object) href)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment