Skip to content

Commit

Permalink
fix: handle url and displayName better when there are more than one l…
Browse files Browse the repository at this point in the history
…anguage configured (#20)

Co-authored-by: Martin Zanoni <[email protected]>
  • Loading branch information
mzanoni and mzanoni authored Jan 13, 2023
1 parent 35714cd commit 1bf2d91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Integrations.Umbraco/Services/ContentMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private async Task AutoMapOrUseMapper(MapContent content, List<string> culturesT
contentUpdate.Content.Data ??= new Dictionary<string, DataValue?>();
contentUpdate.Content.Data.Add(Constants.VersionKey, content.Version);
contentUpdate.Content.Data.Add("contentTypeAlias", content.PublishedContent.ContentType.Alias);
contentUpdate.Content.Data.Add("url", content.PublishedContent.Url(null, UrlMode.Absolute));
contentUpdate.Content.Data.Add("url", new Multilingual(culturesToPublish.Select(x => new Multilingual.Value(x, content.PublishedContent.Url(x, UrlMode.Absolute))).ToList()));
contentUpdate.Content.Data.Add("createdAt", new DateTimeOffset(content.PublishedContent.CreateDate).ToUnixTimeSeconds());

bool TryGetMapper(MapContent mapContent, [NotNullWhen(true) ]out IContentTypeMapping? contentTypeMapping)
Expand All @@ -97,7 +97,7 @@ bool TryGetMapper(MapContent mapContent, [NotNullWhen(true) ]out IContentTypeMap

private static Multilingual MapDisplayName(IPublishedContent content, List<string> culturesToPublish)
{
return new Multilingual(culturesToPublish.Select(x => new Multilingual.Value(x, content.Name)).ToList());
return new Multilingual(culturesToPublish.Select(x => new Multilingual.Value(x, content.Name(x))).ToList());
}

private static string GetDefaultCulture(UmbracoContextReference umbracoContextReference)
Expand Down

0 comments on commit 1bf2d91

Please sign in to comment.