Renders a href attribute on the target tag with the URL for the specified page.
Usage
The anchor tag helper can be used with html anchor (a) tags by adding a rx-href attribute to the element. The following attributes can be used.
rx-hrefrequired - the object to render a URL for. Must be a node view model (INodeViewModel), an object of typeIPublishedContent, aLinkobject, or a valid node idstring.rx-href-cultureoptional - the culture of the page to link to. Uses the current request culture if not specified.rx-href-if-emptyoptional - the action to take if the page does not exist or is not published. The following options are available:EmptyAction.Nonedefault - do nothing; the anchor will be rendered without (overwriting) thehrefattribute.EmptyAction.ClearContent- clears the anchor content but renders the tag.EmptyAction.RemoveTag- completely removes the anchor from the output.
Examples
<body>
<a rx-href="@await Model.NextSiblingAsync()" rx-href-if-empty="EmptyAction.RemoveTag">Next article</a>
<a rx-href="@Model.ParentId">Go up...</a>
@foreach (var link in await Model.Content.Articles)
{
<a rx-href="@link">@link.Title</a>
}
</body>