From f4a5af44efb5bcb2f3b027bcff0035a91e621734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=9Furhan=20G=C3=BCl?= Date: Wed, 31 May 2023 15:46:54 +0300 Subject: [PATCH] SeoSchema added to support schema.org scripts --- .../Composers/MetaFieldsComposer.cs | 3 +- .../Constants/SeoFieldAliasConstants.cs | 1 + .../Models/SeoField/SeoSchemaField.cs | 28 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/SeoToolkit.Umbraco.MetaFields.Core/Models/SeoField/SeoSchemaField.cs diff --git a/src/SeoToolkit.Umbraco.MetaFields.Core/Composers/MetaFieldsComposer.cs b/src/SeoToolkit.Umbraco.MetaFields.Core/Composers/MetaFieldsComposer.cs index 61a1e49d..69e8b98c 100644 --- a/src/SeoToolkit.Umbraco.MetaFields.Core/Composers/MetaFieldsComposer.cs +++ b/src/SeoToolkit.Umbraco.MetaFields.Core/Composers/MetaFieldsComposer.cs @@ -50,7 +50,7 @@ public void Compose(IUmbracoBuilder builder) } builder.Components().Append(); - + builder.Services.AddTransient(typeof(IRepository), typeof(MetaFieldsSettingsDatabaseRepository)); builder.Services.AddTransient(typeof(IMetaFieldsSettingsService), typeof(MetaFieldsSettingsService)); builder.Services.AddTransient(typeof(IMetaFieldsService), typeof(MetaFieldsService)); @@ -67,6 +67,7 @@ public void Compose(IUmbracoBuilder builder) .Add() .Add() .Add() + .Add() .Add(); builder.WithCollectionBuilder() diff --git a/src/SeoToolkit.Umbraco.MetaFields.Core/Constants/SeoFieldAliasConstants.cs b/src/SeoToolkit.Umbraco.MetaFields.Core/Constants/SeoFieldAliasConstants.cs index 9dcf823b..0b8882de 100644 --- a/src/SeoToolkit.Umbraco.MetaFields.Core/Constants/SeoFieldAliasConstants.cs +++ b/src/SeoToolkit.Umbraco.MetaFields.Core/Constants/SeoFieldAliasConstants.cs @@ -4,6 +4,7 @@ public static class SeoFieldAliasConstants { public const string Title = "title"; public const string Keywords = "keywords"; + public const string Schema = "schema"; public const string MetaDescription = "metaDescription"; public const string OpenGraphTitle = "openGraphTitle"; public const string OpenGraphDescription = "openGraphDescription"; diff --git a/src/SeoToolkit.Umbraco.MetaFields.Core/Models/SeoField/SeoSchemaField.cs b/src/SeoToolkit.Umbraco.MetaFields.Core/Models/SeoField/SeoSchemaField.cs new file mode 100644 index 00000000..7056ee8e --- /dev/null +++ b/src/SeoToolkit.Umbraco.MetaFields.Core/Models/SeoField/SeoSchemaField.cs @@ -0,0 +1,28 @@ +using System; +using Microsoft.AspNetCore.Html; +using Umbraco.Cms.Core.Composing; +using SeoToolkit.Umbraco.MetaFields.Core.Common.SeoFieldEditEditors; +using SeoToolkit.Umbraco.MetaFields.Core.Constants; +using SeoToolkit.Umbraco.MetaFields.Core.Interfaces.SeoField; +using SeoToolkit.Umbraco.MetaFields.Core.Models.SeoFieldEditors; + +namespace SeoToolkit.Umbraco.MetaFields.Core.Models.SeoField +{ + [Weight(200)] + public class SeoSchemaField : ISeoField + { + public string Title => "Schema"; + public string Alias => SeoFieldAliasConstants.Schema; + public string Description => "The schemas are a set of 'types', each associated with a set of properties. The types are arranged in a hierarchy."; + public string GroupAlias => SeoFieldGroupConstants.MetaFieldsGroup; + public Type FieldType => typeof(string); + + public ISeoFieldEditor Editor => new SeoFieldFieldsEditor(new[] { "Umbraco.TextBox", "Umbraco.TextArea", "Umbraco.TinyMCE" }); + public ISeoFieldEditEditor EditEditor => new SeoTextAreaEditEditor(); + + public HtmlString Render(object value) + { + return new HtmlString($""); + } + } +}