using ToSic.Razor.Blade;

// todo: change to use Get
public class Links : Custom.Hybrid.Code12
{
  // Returns a safe url to a post details page
  public dynamic LinkToDetailsPage(dynamic post) {
    var detailsPageTabId = Text.Has(Settings.DetailsPage)
      ? int.Parse((AsEntity(App.Settings).GetBestValue("DetailsPage")).Split(':')[1])
      : CmsContext.Page.Id;

    return Link.To(pageId: detailsPageTabId, parameters: "details=" + post.UrlKey);
  }
}

using ToSic.Razor.Blade;

public class Links : Custom.Hybrid.Code12
{
  /// <Summary>
  /// Returns a safe url to a post details page
  /// </Summary>
  public dynamic LinkToDetailsPage(dynamic post) {
    return Link.To(pageId: DetailsPageId, parameters: "details=" + post.UrlKey);
  }

  /// <Summary>
  /// Get / cache the page which will show the details of a post
  /// </Summary>
  private int DetailsPageId
  {
    get
    {
      if (_detailsPageId != 0) return _detailsPageId;
      if (Text.Has(Settings.DetailsPage))
        _detailsPageId = int.Parse((App.Settings.Get("DetailsPage", convertLinks: false)).Split(':')[1]);
      else
        _detailsPageId = CmsContext.Page.Id;
      return _detailsPageId;
    }
  }
  private int _detailsPageId;
}

Improve how the link is made and page is cached
Improve how the link is made and page is cached
