Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an our-tag tag helper #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AndyBoot
Copy link
Contributor

our-tag

This tag helper attribute can be seamlessly integrated with any DOM element within the Razor file. It allows content editors to oversee SEO by designating the appropriate HTML tags for distinct elements. Consider a scenario where you have an item in your block list named 'Heading Tag' - maybe it's from a predefined dropdown? This is saved as a straightforward string. Your block view then fetches this value through the model, making it accessible for the 'our-tag' tag helper.

Example 1

// Model.Heading = "This is my heading"
// Model.HeadingTag = "H1"
<h2 class="my-heading" our-tag="@Model.HeadingTag">@Model.Heading</h2>

Output

The hardcoded h2 has been replaced with an h1 element tag.

<h1 class="my-heading">This is my heading</h1>

Example 2

// Model.Heading = "This is my heading"
// Model.HeadingTag = ""
<h2 class="my-heading" our-tag="@Model.HeadingTag">@Model.Heading</h2>

Output

Defaults to the original hardcoded element tag:

<h2 class="my-heading">This is my heading</h2>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant