示例#1
0
        public string GetAboutHtml(RequestLang lang = RequestLang.Chinese)
        {
            var cacheKey = CacheKeyBuilder.Build(SiteComponent.Blog, "about", lang);

            if (!_memoryCacheClient.TryGet <string>(cacheKey, out var html))
            {
                html = string.Empty;
            }

            return(html);
        }
示例#2
0
        private async Task <string> GetAboutFromFileAsync(RequestLang lang)
        {
            var aboutPath = Path.Combine(_appConfig.AssetRepoLocalDir,
                                         string.Format(BlogConstant.AboutGitHub, lang == RequestLang.Chinese ? "zh" : "en"));

            if (!File.Exists(aboutPath))
            {
                return(string.Empty);
            }

            var md = await File.ReadAllTextAsync(aboutPath);

            return(Markdown.ToHtml(md));
        }