-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logic for sitemap collections (#184)
- Loading branch information
1 parent
6308cc1
commit f2df0d8
Showing
7 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/SeoToolkit.Umbraco.Site/ExampleCode/ExampleSitemapCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using SeoToolkit.Umbraco.Sitemap.Core.Interfaces; | ||
using SeoToolkit.Umbraco.Sitemap.Core.Models.Business; | ||
|
||
namespace SeoToolkit.Umbraco.Site.ExampleCode | ||
{ | ||
public class ExampleSitemapCollection : ISitemapCollectionProvider | ||
{ | ||
public SitemapNodeItem[] GetItems() | ||
{ | ||
return new SitemapNodeItem[] | ||
{ | ||
new SitemapNodeItem("https://google.nl?test=true") | ||
}; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/SeoToolkit.Umbraco.Site/ExampleCode/StartupComposer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using SeoToolkit.Umbraco.Sitemap.Core.Collections; | ||
using Umbraco.Cms.Core.Composing; | ||
using Umbraco.Cms.Core.DependencyInjection; | ||
|
||
namespace SeoToolkit.Umbraco.Site.ExampleCode | ||
{ | ||
public class StartupComposer : IComposer | ||
{ | ||
public void Compose(IUmbracoBuilder builder) | ||
{ | ||
builder.SitemapCollections().Append<ExampleSitemapCollection>(); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/SeoToolkit.Umbraco.Sitemap.Core/Collections/SitemapCollectionProviderCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using SeoToolkit.Umbraco.Sitemap.Core.Interfaces; | ||
using System; | ||
using System.Collections.Generic; | ||
using Umbraco.Cms.Core.Composing; | ||
|
||
namespace SeoToolkit.Umbraco.Sitemap.Core.Collections | ||
{ | ||
public class SitemapCollectionProviderCollection : BuilderCollectionBase<ISitemapCollectionProvider> | ||
{ | ||
public SitemapCollectionProviderCollection(Func<IEnumerable<ISitemapCollectionProvider>> items) : base(items) | ||
{ | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...SeoToolkit.Umbraco.Sitemap.Core/Collections/SitemapCollectionProviderCollectionBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using SeoToolkit.Umbraco.Sitemap.Core.Interfaces; | ||
using Umbraco.Cms.Core.Composing; | ||
|
||
namespace SeoToolkit.Umbraco.Sitemap.Core.Collections | ||
{ | ||
public class SitemapCollectionProviderCollectionBuilder : OrderedCollectionBuilderBase<SitemapCollectionProviderCollectionBuilder, SitemapCollectionProviderCollection, ISitemapCollectionProvider> | ||
{ | ||
protected override SitemapCollectionProviderCollectionBuilder This => this; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/SeoToolkit.Umbraco.Sitemap.Core/Collections/SitmapCollectionProviderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Umbraco.Cms.Core.DependencyInjection; | ||
|
||
namespace SeoToolkit.Umbraco.Sitemap.Core.Collections | ||
{ | ||
public static class SitmapCollectionProviderExtensions | ||
{ | ||
public static SitemapCollectionProviderCollectionBuilder SitemapCollections(this IUmbracoBuilder builder) | ||
=> builder.WithCollectionBuilder<SitemapCollectionProviderCollectionBuilder>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/SeoToolkit.Umbraco.Sitemap.Core/Interfaces/ISitemapCollectionProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using SeoToolkit.Umbraco.Sitemap.Core.Models.Business; | ||
|
||
namespace SeoToolkit.Umbraco.Sitemap.Core.Interfaces | ||
{ | ||
public interface ISitemapCollectionProvider | ||
{ | ||
SitemapNodeItem[] GetItems(); | ||
} | ||
} |