Skip to content

Commit

Permalink
Update TryFindContent references
Browse files Browse the repository at this point in the history
  • Loading branch information
sofietoft committed Jun 8, 2022
1 parent 643ddb0 commit cb9e692
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Implementation/Services/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ namespace Umbraco9.Components
Inside a ContentFinder access to the content cache is possible by injecting `IUmbracoContextAccessor` into the constructor and provided via the PublishedRequest object:

```csharp
public bool TryFindContent(IPublishedRequestBuilder frequest)
public Task<bool> TryFindContent(IPublishedRequestBuilder request)
{
if (!UmbracoContextAccessor.TryGetUmbracoContext(out var umbracoContext))
{
Expand Down
10 changes: 5 additions & 5 deletions Reference/Routing/Request-Pipeline/IContentFinder.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To create a custom content finder, with custom logic to find an Umbraco document
```csharp
public interface IContentFinder
{
bool TryFindContent(IPublishedRequestBuilder contentRequest);
Task<bool> TryFindContent(IPublishedRequestBuilder contentRequest);
}
```

Expand All @@ -35,7 +35,7 @@ public class MyContentFinder : IContentFinder
_umbracoContextAccessor = umbracoContextAccessor;
}

public bool TryFindContent(IPublishedRequestBuilder contentRequest)
public Task<bool> TryFindContent(IPublishedRequestBuilder contentRequest)
{
// Handle all requests beginning with /woot
var path = contentRequest.Uri.GetAbsolutePathDecoded();
Expand Down Expand Up @@ -113,7 +113,6 @@ public void ConfigureServices(IServiceCollection services)
}
```


#### Composer

```csharp
Expand All @@ -140,6 +139,7 @@ namespace RoutingDocs.ContentFinders
}

```

:::note
In Umbraco 7 there existed an IContentFinder that would find content and display it with an 'alternative template' via a convention. This could be to avoid the ugly `?alttemplate=blogfullstory` appearing on the querystring of the url when using the alternative template mechanism. Instead the Url could follow the convention of `/urltocontent/altemplatealias`.

Expand All @@ -148,7 +148,7 @@ Eg: `/blog/my-blog-post/blogfullstory` would 'find' the `/blog/my-blog-post` pag
In Umbraco 9 this convention has been removed from the default configuration of Umbraco. You can reintroduce this behavior by adding the `ContentFinderByUrlAndTemplate` ContentFinder back into the ContentFinderCollection, using an `IComposer`, or Umbraco builder extension (see above example).
:::

# NotFoundHandlers
## NotFoundHandlers

To set your own 404 finder create an IContentLastChanceFinder and set it as the ContentLastChanceFinder. (perhaps you have a multilingual site and need to find the appropriate 404 page in the correct language)

Expand All @@ -174,7 +174,7 @@ namespace RoutingDocs.ContentFinders
_umbracoContextAccessor = umbracoContextAccessor;
}

public bool TryFindContent(IPublishedRequestBuilder contentRequest)
public Task<bool> TryFindContent(IPublishedRequestBuilder contentRequest)
{
// Find the root node with a matching domain to the incoming request
var allDomains = _domainService.GetAll(true).ToList();
Expand Down

0 comments on commit cb9e692

Please sign in to comment.