Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdemooij9 committed Jul 4, 2023
2 parents e3ff369 + 25e9b41 commit df990a8
Show file tree
Hide file tree
Showing 32 changed files with 88 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/SeoToolkit.Umbraco.Common/ManifestLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Filter(List<PackageManifest> manifests)
manifests.Add(new PackageManifest
{
PackageName = "SeoToolkit.Umbraco.Common",
Version = "3.1.0",
Version = "3.2.0",
Scripts = new[]
{
"/App_Plugins/SeoToolkit/Dashboards/welcomeDashboard.controller.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
<StaticWebAssetBasePath>App_Plugins/SeoToolkit</StaticWebAssetBasePath>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/SeoToolkit.Umbraco.Core/SeoToolkit.Umbraco.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.3</Version>
<Version>3.2.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public string CanonicalUrl
set => SetValue(SeoFieldAliasConstants.CanonicalUrl, value);
}

public string[] Robots
{
get => GetValue<string[]>(SeoFieldAliasConstants.Robots);
set => SetValue(SeoFieldAliasConstants.Robots, value);
}

public string Keywords
{
get => GetValue<string>(SeoFieldAliasConstants.Keywords);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using SeoToolkit.Umbraco.MetaFields.Core.Models.SeoService;
using System;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.Notifications;

namespace SeoToolkit.Umbraco.MetaFields.Core.Notifications
Expand All @@ -7,11 +9,20 @@ public class AfterMetaTagsNotification : INotification
{
public string ContentTypeAlias { get; }
public MetaTagsModel MetaTags { get; }
public IPublishedContent Content { get; }

[Obsolete("This constructor is deprecated and will be removed in the next major release.")]
public AfterMetaTagsNotification(string contentTypeAlias, MetaTagsModel metaTags)
{
ContentTypeAlias = contentTypeAlias;
MetaTags = metaTags;
}

public AfterMetaTagsNotification(IPublishedContent content, MetaTagsModel metaTags)
{
Content = content;
ContentTypeAlias = content.ContentType.Alias;
MetaTags = metaTags;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using SeoToolkit.Umbraco.MetaFields.Core.Models.SeoService;
using System;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.Notifications;

namespace SeoToolkit.Umbraco.MetaFields.Core.Notifications
Expand All @@ -7,11 +9,20 @@ public class BeforeMetaTagsNotification : INotification
{
public string ContentTypeAlias { get; }
public MetaTagsModel MetaTags { get; }
public IPublishedContent Content { get; }

[Obsolete("This constructor is deprecated and will be removed in the next major release.")]
public BeforeMetaTagsNotification(string contentTypeAlias, MetaTagsModel metaTags)
{
ContentTypeAlias = contentTypeAlias;
MetaTags = metaTags;
}

public BeforeMetaTagsNotification(IPublishedContent content, MetaTagsModel metaTags)
{
Content = content;
ContentTypeAlias = content.ContentType.Alias;
MetaTags = metaTags;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public MetaTagsModel Get(IPublishedContent content, bool includeUserValues)

//Make sure that the fields are set, otherwise the values cannot be set!
var metaTags = new MetaTagsModel(allFields.ToDictionary(it => it, it => (object)null));
_eventAggregator.Publish(new BeforeMetaTagsNotification(content.ContentType.Alias, metaTags));
_eventAggregator.Publish(new BeforeMetaTagsNotification(content, metaTags));

var settings = _documentTypeSettingsService.Get(content.ContentType.Id);
if (_seoSettingsService.IsEnabled(content.ContentType.Id) != true)
Expand Down Expand Up @@ -111,7 +111,7 @@ public MetaTagsModel Get(IPublishedContent content, bool includeUserValues)
metaTags.SetValue(fieldValue.Field.Alias, fieldValue.Value);
}

_eventAggregator.Publish(new AfterMetaTagsNotification(content.ContentType.Alias, metaTags));
_eventAggregator.Publish(new AfterMetaTagsNotification(content, metaTags));

return metaTags;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.3</Version>
<Version>3.2.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/SeoToolkit.Umbraco.MetaFields/ManifestLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Filter(List<PackageManifest> manifests)
manifests.Add(new PackageManifest
{
PackageName = "SeoToolkit.Umbraco.MetaFields",
Version = "3.1.3",
Version = "3.2.0",
Scripts = new[]
{
"/App_Plugins/SeoToolkit/MetaFields/Interface/ContentApps/DocumentSettings/documentSettings.controller.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.3</Version>
<Version>3.2.0</Version>
<StaticWebAssetBasePath>App_Plugins/SeoToolkit</StaticWebAssetBasePath>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
Expand All @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
31 changes: 25 additions & 6 deletions src/SeoToolkit.Umbraco.Redirects.Core/Services/RedirectsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,39 @@ public RedirectFindResult GetByUrl(Uri uri)
using (var ctx = _umbracoContextFactory.EnsureUmbracoContext())
{
var domain = DomainUtilities.SelectDomain(ctx.UmbracoContext.Domains.GetAll(false), uri);

var pathAndQuery = uri.PathAndQuery.CleanUrl();
var globalUrls = new List<string>
{
uri.AbsolutePath.CleanUrl(),
pathAndQuery
};
List<string> domainUrls = null;

if (domain != null)
{
//We do this to ensure that we support subdirectories. So if you have domain domain.com/en and relative path /test123, you don't also need to include the subdirectory /en/test123.
uri = new Uri(domain.Uri, uri.AbsolutePath.TrimStart(domain.Uri.LocalPath));
var domainUrl = uri.AbsolutePath.CleanUrl().TrimStart(domain.Uri.LocalPath);

domainUrls = new List<string>
{
domainUrl,
$"{domainUrl}{uri.Query}"
};
}

var path = uri.AbsolutePath.CleanUrl();
var pathAndQuery = uri.PathAndQuery.CleanUrl();
var customDomainWithoutScheme = uri.Host;
var customDomainWithScheme = $"{uri.Scheme}://{uri.Host}";

var urlsToSearch = new List<string>();
urlsToSearch.AddRange(globalUrls);
if (domainUrls != null)
{
urlsToSearch.AddRange(domainUrls);
}

//Because we are checking both the url with and without query, we might get two urls.
var redirects = _redirectsRepository.GetByUrls(path, pathAndQuery).ToArray();
var redirects = _redirectsRepository.GetByUrls(urlsToSearch.Distinct().ToArray()).ToArray();
if (redirects.Length > 0)
{
Redirect foundRedirect = null;
Expand All @@ -125,8 +145,7 @@ public RedirectFindResult GetByUrl(Uri uri)
foundRedirect = redirects.FirstOrDefault(it =>
it.Domain is null &&
string.IsNullOrWhiteSpace(it.CustomDomain) &&
(it.OldUrl.Equals(path, StringComparison.InvariantCultureIgnoreCase) ||
it.OldUrl.Equals(pathAndQuery, StringComparison.InvariantCultureIgnoreCase)));
globalUrls.Contains(it.OldUrl, StringComparer.InvariantCultureIgnoreCase));
if (foundRedirect != null) return new RedirectFindResult(uri, foundRedirect);
}

Expand Down
2 changes: 1 addition & 1 deletion src/SeoToolkit.Umbraco.Redirects/ManifestLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Filter(List<PackageManifest> manifests)
manifests.Add(new PackageManifest
{
PackageName = "SeoToolkit.Umbraco.Redirects",
Version = "3.1.0",
Version = "3.2.0",
Scripts = new[]
{
"/App_Plugins/SeoToolkit/backoffice/Redirects/list.controller.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
<StaticWebAssetBasePath>App_Plugins/SeoToolkit</StaticWebAssetBasePath>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"css": [
"/App_Plugins/SeoToolkit/Redirects/css/main.css"
],
"version": "3.1.0",
"version": "3.2.0",
"name": "SeoToolkit.Umbraco.Redirects"
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
return item.id;
})
}).then(function (response) {
setItems(response.data);
setItems(response.data.items);
clearSelection();

if (response.status === 200) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.1</Version>
<Version>3.2.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/SeoToolkit.Umbraco.RobotsTxt/ManifestLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Filter(List<PackageManifest> manifests)
manifests.Add(new PackageManifest
{
PackageName = "SeoToolkit.Umbraco.RobotsTxt",
Version = "3.1.1",
Version = "3.2.0",
Scripts = new[]
{
"/App_Plugins/SeoToolkit/backoffice/RobotsTxt/detail.controller.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.1</Version>
<Version>3.2.0</Version>
<StaticWebAssetBasePath>App_Plugins/SeoToolkit</StaticWebAssetBasePath>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ public void Compose(IUmbracoBuilder builder)
builder.Services.AddSingleton(typeof(ISettingsService<ScriptManagerConfigModel>), typeof(ScriptManagerConfigurationService));

var disabledModules = section?.Get<ScriptManagerAppSettingsModel>()?.DisabledModules ?? Array.Empty<string>();

if (disabledModules.Contains(DisabledModuleConstant.All))
{
builder.Components().Append<DisableModuleComponent>();
builder.Trees().RemoveTreeController(typeof(ScriptManagerTreeController));
return;
}

if (disabledModules.Contains(DisabledModuleConstant.SectionTree))
{
builder.Trees().RemoveTreeController(typeof(ScriptManagerTreeController));
}

builder.ScriptDefinitions()
.Add<GoogleTagManagerDefinition>()
.Add<GoogleAnalyticsDefinition>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
Expand All @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/SeoToolkit.Umbraco.ScriptManager/ManifestLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Filter(List<PackageManifest> manifests)
manifests.Add(new PackageManifest
{
PackageName = "SeoToolkit.Umbraco.ScriptManager",
Version = "3.1.0",
Version = "3.2.0",
Scripts = new[]
{
"/App_Plugins/SeoToolkit/backoffice/ScriptManager/list.controller.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
<RazorCompileToolset>RazorSdk</RazorCompileToolset>
<RazorCompileOnBuild>true</RazorCompileOnBuild>
<EmbedRazorGenerateSources>true</EmbedRazorGenerateSources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>2.1.0</Version>
<Version>2.2.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/SeoToolkit.Umbraco.SiteAudit/ManifestLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Filter(List<PackageManifest> manifests)
manifests.Add(new PackageManifest
{
PackageName = "SeoToolkit.Umbraco.SiteAudit",
Version = "2.1.0",
Version = "2.2.0",
Scripts = new[]
{
"/App_Plugins/SeoToolkit/SiteAudit/Interface/Dashboards/SiteAudit/siteAuditDashboard.controller.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>2.1.0</Version>
<Version>2.2.0</Version>
<StaticWebAssetBasePath>App_Plugins/SeoToolkit</StaticWebAssetBasePath>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.1</Version>
<Version>3.2.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/SeoToolkit.Umbraco.Sitemap/ManifestLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Filter(List<PackageManifest> manifests)
manifests.Add(new PackageManifest
{
PackageName = "SeoToolkit.Umbraco.Sitemap",
Version = "3.1.1",
Version = "3.2.0",
Scripts = new[]
{
"/App_Plugins/SeoToolkit/Sitemap/Displays/DocumentType/sitemapSettings.controller.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</PackageProjectUrl>
<RepositoryUrl>https://github.com/patrickdemooij9/SeoToolkit.Umbraco</RepositoryUrl>
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SeoToolkit.Umbraco/main/package/SeoToolkitIcon.png</PackageIconUrl>
<Version>3.1.1</Version>
<Version>3.2.0</Version>
<StaticWebAssetBasePath>App_Plugins/SeoToolkit</StaticWebAssetBasePath>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/SeoToolkit.Umbraco/ManifestLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Filter(List<PackageManifest> manifests)
manifests.Add(new PackageManifest
{
PackageName = "SeoToolkit.Umbraco",
Version = "3.1.3",
Version = "3.2.0",
Scripts = new[]
{
"/App_Plugins/SeoToolkit/backoffice/License/licenseDashboard.controller.js"
Expand Down
Loading

0 comments on commit df990a8

Please sign in to comment.