Geta Tags is a library that adds tagging functionality to Optimizely content.
- Define tag properties
- Query for data
- Admin page for managing tags
- Tags maintenance schedule job
See the editor guide for more information.
Start by installing NuGet package (use Optimizely NuGet):
dotnet add package Geta.Optimizely.Tags
Geta Tags library uses tag-it jQuery UI plugin for selecting tags. To add Tags as a new property to your page types, you need to use the UIHint attribute like in this example:
[UIHint("Tags")]
public virtual string Tags { get; set; }
[TagsGroupKey("mykey")]
[UIHint("Tags")]
public virtual string Tags { get; set; }
[CultureSpecific]
[UIHint("Tags")]
public virtual string Tags { get; set; }Register tags in Startup.cs using folllowing service extension
services.AddGetaTags();Then, call UseGetaTags in the Configure method:
app.UseGetaTags();Also, you have to add Razor pages routing support.
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
});Use ITagEngine to query for data:
IEnumerable<ContentData> GetContentByTag(string tagName);
IEnumerable<ContentData> GetContentsByTag(Tag tag);
IEnumerable<ContentData> GetContentsByTag(string tagName, ContentReference rootContentReference);
IEnumerable<ContentData> GetContentsByTag(Tag tag, ContentReference rootContentReference);
IEnumerable<ContentReference> GetContentReferencesByTags(string tagNames);
IEnumerable<ContentReference> GetContentReferencesByTags(IEnumerable<Tag> tags);
IEnumerable<ContentReference> GetContentReferencesByTags(string tagNames, ContentReference rootContentReference);
IEnumerable<ContentReference> GetContentReferencesByTags(IEnumerable<Tag> tags, ContentReference rootContentReference);You can customize the Tag-it.js settings by using the GetaTagsAttribute. The following settings can currently be customized
- allowSpaces - defaults to false
- allowDuplicates - defaults to false
- caseSensitive - defaults to true
- readOnly - defaults to false
- tagLimit - defaults to -1 (none)
[CultureSpecific]
[UIHint("Tags")]
[GetaTags(AllowSpaces = true, AllowDuplicates = true, CaseSensitive = false, ReadOnly = true)]
public virtual string Tags { get; set; }Ensure your system is properly configured to meet all prerequisites for Geta Foundation Core listed here
git clone https://github.com/Geta/geta-optimizely-tags.git
cd geta-optimizely-tags
git submodule update --init # Windows
cd sub/geta-foundation-core/src/Foundation.AppHost
dotnet run
# Linux / MacOS
# Make sure your user can access Docker (member of the 'docker' group) so 'dotnet run' can start the containers.
chmod +x sub/geta-foundation-core/src/Foundation/docker/build-script/*.sh
cd sub/geta-foundation-core/src/Foundation.AppHost
dotnet run # Windows
cd sub/geta-foundation-core
./setup.cmd
cd ../../src/Geta.Optimizely.Tags.Web
dotnet run
# Linux / MacOS
# Make sure your user can access Docker (member of the 'docker' group) so the setup/build can start the containers.
cd sub/geta-foundation-core
chmod +x *.sh
./setup.sh
cd ../../src/Geta.Optimizely.Tags.Web
dotnet runThe sample runs without Graph credentials out of the box β the Optimizely:ContentGraph keys in
src/Geta.Optimizely.Tags.Web/appsettings.json are empty, so the Graph sync client is replaced with a
no-op and the site starts normally (no "Invalid credentials" startup failure). To enable Graph indexing
and search, fill in AppKey, Secret, and SingleKey from your Optimizely Graph subscription.
If you run into any issues, check the FAQ section here
CMS username: admin@example.com
Password: Episerver123!