-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
63 additions
and
25 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,10 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
using System.Linq; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
namespace Kentico.Kontent.Statiq.Memoirs.Models | ||
{ | ||
public partial class Author | ||
{ | ||
public string Gravatar => CreateMD5(Email); | ||
|
||
private static string CreateMD5(string input) | ||
{ | ||
// Use input string to calculate MD5 hash | ||
using (MD5 md5 = MD5.Create()) | ||
{ | ||
byte[] inputBytes = Encoding.ASCII.GetBytes(input); | ||
byte[] hashBytes = md5.ComputeHash(inputBytes); | ||
|
||
// Convert the byte array to hexadecimal string | ||
StringBuilder sb = new StringBuilder(); | ||
for (int i = 0; i < hashBytes.Length; i++) | ||
{ | ||
sb.Append(hashBytes[i].ToString("x2")); | ||
} | ||
return sb.ToString(); | ||
} | ||
} | ||
} | ||
} |
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
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
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,37 @@ | ||
@using Kentico.Kontent.ImageTransformation | ||
@using Kentico.Kontent.Statiq.Memoirs.Models | ||
@using MemoirsTheme.Helpers | ||
@model Kentico.Kontent.Statiq.Memoirs.Models.Author | ||
@{ | ||
var site = ViewData["SiteMetaData"] as SiteSettings; | ||
} | ||
<!-- Author Box --> | ||
@if( Model != null && site.AuthorBox){ | ||
<div class="d-flex authorbox align-items-center"> | ||
<div class="col-md-2 mr-4 text-center"> | ||
@if (Model?.AvatarImage != null) | ||
{ | ||
@Html.Image(Model.AvatarImage, Model.Name, site.LazyImages, 580, 400, ImageFitMode.Crop, new { @class = "img-thumb" }) | ||
} | ||
else | ||
{ | ||
<img class="author-thumb" src="https://www.gravatar.com/avatar/@Model.Gravatar?s=250&d=mm&r=x" alt="@Model.Name"> | ||
} | ||
</div> | ||
<div class="col-md-10"> | ||
@foreach (var contact in Model.Contacts.OfType<Contact>()) | ||
{ | ||
@if (contact.Icon == "web") | ||
{ | ||
<a target="_blank" class="text-dark h4" href="@contact.Url">About @Model.Name</a> | ||
} | ||
else | ||
{ | ||
<a target="_blank" href="@contact.Url" class="btn-sm"><i class="fab [email protected]"></i></a> | ||
} | ||
} | ||
|
||
<span class="author-description d-block mt-2">@Model.Bio</span> | ||
</div> | ||
</div> | ||
} |
This file was deleted.
Oops, something went wrong.
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
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