Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions 10/umbraco-cms/reference/querying/itagquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: "Working with tags in Umbraco"

# ITagQuery

The `ITagQuery` interface is your primary way to work with tags in Umbraco, the interface allows you to get the various tags like content tags and media tags, as well as getting content by tag, for instance getting all content nodes with the "Umbraco" tag.
The `ITagQuery` interface is your primary way to work with tags in Umbraco. This interface allows you to get different tags, such as content tags and media tags. It also lets you retrieve content by tag, for instance, getting all content nodes with the "Umbraco" tag.

## How to reference ITagQuery

Expand Down Expand Up @@ -49,7 +49,7 @@ namespace UmbracoHelperDocs.Controllers
```

{% hint style="warning" %}
`ITagQuery` is a scoped service, meaning that it should only be injected into scoped or transient services, for more information see the official [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/extensions/dependency-injection#scoped)
`ITagQuery` is a scoped service, meaning that it should only be injected into scoped or transient services. For more information see the official [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/extensions/dependency-injection#scoped)
{% endhint %}

## Examples
Expand All @@ -58,7 +58,7 @@ All examples are from a view using the injection shown above, but working with t

### GetAllContentTags([string tagGroup])

Get a collection of tags used by content items on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by content items on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -69,7 +69,7 @@ Get a collection of tags used by content items on the site, you can optionally p

### GetAllMediaTags([string tagGroup])

Get a collection of tags used by media items on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by media items on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -80,7 +80,7 @@ Get a collection of tags used by media items on the site, you can optionally pas

### GetAllMemberTags([string tagGroup])

Get a collection of tags used by members on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by members on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -91,7 +91,7 @@ Get a collection of tags used by members on the site, you can optionally pass in

### GetAllTags([string tagGroup])

Get a collection of tags used on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand Down Expand Up @@ -152,7 +152,7 @@ Get a collection of tags by entity id (queries content, media and members), and

### GetTagsForProperty(int contentId, string propertyTypeAlias, [string tagGroup])

Get a collection of tags assigned to a property of an entity (queries content, media and members), and you can optionally filter by tag group as well
Get a collection of tags assigned to a property of an entity (queries content, media and members). Optionally, you can filter by tag group as well

```csharp
@{
Expand Down
14 changes: 7 additions & 7 deletions 13/umbraco-cms/reference/querying/itagquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Working with tags in Umbraco

# ITagQuery

The `ITagQuery` interface is your primary way to work with tags in Umbraco, the interface allows you to get the various tags like content tags and media tags, as well as getting content by tag, for instance getting all content nodes with the "Umbraco" tag.
The `ITagQuery` interface is your primary way to work with tags in Umbraco. This interface allows you to get different tags, such as content tags and media tags. It also lets you retrieve content by tag, for instance, getting all content nodes with the "Umbraco" tag.

## How to reference ITagQuery

Expand Down Expand Up @@ -45,7 +45,7 @@ public class TagApiController : UmbracoApiController
```

{% hint style="warning" %}
`ITagQuery` is a scoped service, meaning that it should only be injected into scoped or transient services, for more information see the official [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/extensions/dependency-injection#scoped)
`ITagQuery` is a scoped service, meaning that it should only be injected into scoped or transient services. For more information see the official [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/extensions/dependency-injection#scoped)
{% endhint %}

## Examples
Expand All @@ -54,7 +54,7 @@ All examples are from a view using the injection shown above, but working with t

### GetAllContentTags(\[string tagGroup])

Get a collection of tags used by content items on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by content items on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -65,7 +65,7 @@ Get a collection of tags used by content items on the site, you can optionally p

### GetAllMediaTags(\[string tagGroup])

Get a collection of tags used by media items on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by media items on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -76,7 +76,7 @@ Get a collection of tags used by media items on the site, you can optionally pas

### GetAllMemberTags(\[string tagGroup])

Get a collection of tags used by members on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by members on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -87,7 +87,7 @@ Get a collection of tags used by members on the site, you can optionally pass in

### GetAllTags(\[string tagGroup])

Get a collection of tags used on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand Down Expand Up @@ -148,7 +148,7 @@ Get a collection of tags by entity id (queries content, media and members), and

### GetTagsForProperty(int contentId, string propertyTypeAlias, \[string tagGroup])

Get a collection of tags assigned to a property of an entity (queries content, media and members), and you can optionally filter by tag group as well
Get a collection of tags assigned to a property of an entity (queries content, media and members). Optionally, you can filter by tag group as well

```csharp
@{
Expand Down
25 changes: 11 additions & 14 deletions 14/umbraco-cms/reference/querying/itagquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Working with tags in Umbraco

# ITagQuery

The `ITagQuery` interface is your primary way to work with tags in Umbraco, the interface allows you to get the various tags like content tags and media tags, as well as getting content by tag, for instance getting all content nodes with the "Umbraco" tag.
The `ITagQuery` interface is your primary way to work with tags in Umbraco. This interface allows you to get different tags, such as content tags and media tags. It also lets you retrieve content by tag, for instance, getting all content nodes with the "Umbraco" tag.

## How to reference ITagQuery

Expand All @@ -18,21 +18,17 @@ After this you can use `_tagQuery` to access the `ITagQuery`.

If you're using it in controllers, you can inject it into the constructor like so:

{% hint style="warning" %}
The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15.
{% endhint %}

```csharp
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Web.Common.Controllers;

namespace UmbracoHelperDocs.Controllers;

[Route("tags/[action]")]
public class TagApiController : UmbracoApiController
[ApiController]
[Route("/umbraco/api/tags")]
public class TagApiController : Controller
{
private readonly ITagQuery _tagQuery;

Expand All @@ -41,6 +37,7 @@ public class TagApiController : UmbracoApiController
_tagQuery = tagQuery;
}

[HttpGet("getmediatags")]
public ActionResult<IEnumerable<string>> GetMediaTags()
{
return _tagQuery.GetAllMediaTags().Select(tag => tag.Text).ToList();
Expand All @@ -49,7 +46,7 @@ public class TagApiController : UmbracoApiController
```

{% hint style="warning" %}
`ITagQuery` is a scoped service, meaning that it should only be injected into scoped or transient services, for more information see the official [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/extensions/dependency-injection#scoped)
`ITagQuery` is a scoped service, meaning that it should only be injected into scoped or transient services. For more information see the official [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/extensions/dependency-injection#scoped)
{% endhint %}

## Examples
Expand All @@ -58,7 +55,7 @@ All examples are from a view using the injection shown above, but working with t

### GetAllContentTags(\[string tagGroup])

Get a collection of tags used by content items on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by content items on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -69,7 +66,7 @@ Get a collection of tags used by content items on the site, you can optionally p

### GetAllMediaTags(\[string tagGroup])

Get a collection of tags used by media items on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by media items on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -80,7 +77,7 @@ Get a collection of tags used by media items on the site, you can optionally pas

### GetAllMemberTags(\[string tagGroup])

Get a collection of tags used by members on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by members on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -91,7 +88,7 @@ Get a collection of tags used by members on the site, you can optionally pass in

### GetAllTags(\[string tagGroup])

Get a collection of tags used on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand Down Expand Up @@ -152,7 +149,7 @@ Get a collection of tags by entity id (queries content, media and members), and

### GetTagsForProperty(int contentId, string propertyTypeAlias, \[string tagGroup])

Get a collection of tags assigned to a property of an entity (queries content, media and members), and you can optionally filter by tag group as well
Get a collection of tags assigned to a property of an entity (queries content, media and members). Optionally, you can filter by tag group as well

```csharp
@{
Expand Down
25 changes: 11 additions & 14 deletions 15/umbraco-cms/reference/querying/itagquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Working with tags in Umbraco

# ITagQuery

The `ITagQuery` interface is your primary way to work with tags in Umbraco, the interface allows you to get the various tags like content tags and media tags, as well as getting content by tag, for instance getting all content nodes with the "Umbraco" tag.
The `ITagQuery` interface is your primary way to work with tags in Umbraco. This interface allows you to get different tags, such as content tags and media tags. It also lets you retrieve content by tag, for instance, getting all content nodes with the "Umbraco" tag.

## How to reference ITagQuery

Expand All @@ -18,21 +18,17 @@ After this you can use `_tagQuery` to access the `ITagQuery`.

If you're using it in controllers, you can inject it into the constructor like so:

{% hint style="warning" %}
The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15.
{% endhint %}

```csharp
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Web.Common.Controllers;

namespace UmbracoHelperDocs.Controllers;

[Route("tags/[action]")]
public class TagApiController : UmbracoApiController
[ApiController]
[Route("/umbraco/api/tags")]
public class TagApiController : Controller
{
private readonly ITagQuery _tagQuery;

Expand All @@ -41,6 +37,7 @@ public class TagApiController : UmbracoApiController
_tagQuery = tagQuery;
}

[HttpGet("getmediatags")]
public ActionResult<IEnumerable<string>> GetMediaTags()
{
return _tagQuery.GetAllMediaTags().Select(tag => tag.Text).ToList();
Expand All @@ -49,7 +46,7 @@ public class TagApiController : UmbracoApiController
```

{% hint style="warning" %}
`ITagQuery` is a scoped service, meaning that it should only be injected into scoped or transient services, for more information see the official [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/extensions/dependency-injection#scoped)
`ITagQuery` is a scoped service, meaning that it should only be injected into scoped or transient services. For more information see the official [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/extensions/dependency-injection#scoped)
{% endhint %}

## Examples
Expand All @@ -58,7 +55,7 @@ All examples are from a view using the injection shown above, but working with t

### GetAllContentTags(\[string tagGroup])

Get a collection of tags used by content items on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by content items on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -69,7 +66,7 @@ Get a collection of tags used by content items on the site, you can optionally p

### GetAllMediaTags(\[string tagGroup])

Get a collection of tags used by media items on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by media items on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -80,7 +77,7 @@ Get a collection of tags used by media items on the site, you can optionally pas

### GetAllMemberTags(\[string tagGroup])

Get a collection of tags used by members on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used by members on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand All @@ -91,7 +88,7 @@ Get a collection of tags used by members on the site, you can optionally pass in

### GetAllTags(\[string tagGroup])

Get a collection of tags used on the site, you can optionally pass in a group name to only list tags belonging to a specific tag group
Get a collection of tags used on the site. Optionally, you can pass in a group name to only list tags belonging to a specific tag group

```csharp
@{
Expand Down Expand Up @@ -152,7 +149,7 @@ Get a collection of tags by entity id (queries content, media and members), and

### GetTagsForProperty(int contentId, string propertyTypeAlias, \[string tagGroup])

Get a collection of tags assigned to a property of an entity (queries content, media and members), and you can optionally filter by tag group as well
Get a collection of tags assigned to a property of an entity (queries content, media and members). Optionally, you can filter by tag group as well

```csharp
@{
Expand Down
Loading