File tree Expand file tree Collapse file tree
src/UndefinedLabs/Components/Pages Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11@using UndefinedLabs .Models
22@inject ConvexService ConvexService
3+ @inject IConfiguration Configuration
34@page " /f/{Slug}"
45
56<PageTitle >File - @Slug </PageTitle >
67
8+ @if (_record is not null )
9+ {
10+ <HeadContent >
11+ <meta property =" og:type" content =" website" />
12+ <meta property =" og:title" content =" @_record.FileName" />
13+ <meta property =" og:description" content =" File - @FormatBytes(_record.FileSize) — @_record.ContentType" />
14+ <meta property =" og:url" content =" @_baseUrl/f/@Uri.EscapeDataString(Slug)" />
15+ </HeadContent >
16+ }
17+
718@if (_notFound )
819{
920 <NotFound />
5162
5263 private UploadRecord ? _record ;
5364 private bool _notFound ;
65+ private string _baseUrl = string .Empty ;
5466
5567 protected override async Task OnParametersSetAsync ()
5668 {
5769 _record = null ;
5870 _notFound = false ;
71+ _baseUrl = (Configuration [" PUBLIC_BASE_URL" ] ?? " " ).TrimEnd ('/' );
5972
6073 _record = await ConvexService .QueryAsync <UploadRecord ?>(
6174 " files:getBySlug" ,
Original file line number Diff line number Diff line change 11@using UndefinedLabs .Models
22@inject ConvexService ConvexService
3+ @inject IConfiguration Configuration
34@page " /i/{Slug}"
45
56<PageTitle >Image - @Slug </PageTitle >
67
8+ @if (_record is not null )
9+ {
10+ <HeadContent >
11+ <meta property =" og:type" content =" website" />
12+ <meta property =" og:title" content =" @_record.FileName" />
13+ <meta property =" og:description" content =" @FormatBytes(_record.FileSize) - Uploaded @FormatDate(_record.CreationTime)" />
14+ <meta property =" og:url" content =" @_baseUrl/i/@Uri.EscapeDataString(Slug)" />
15+ <meta property =" og:image" content =" @_baseUrl/content/i/@Uri.EscapeDataString(Slug)" />
16+ <meta property =" og:image:type" content =" @_record.ContentType" />
17+ <meta name =" twitter:card" content =" summary_large_image" />
18+ </HeadContent >
19+ }
20+
721@if (_notFound )
822{
923 <NotFound />
5266
5367 private UploadRecord ? _record ;
5468 private bool _notFound ;
69+ private string _baseUrl = string .Empty ;
5570
5671 protected override async Task OnParametersSetAsync ()
5772 {
5873 _record = null ;
5974 _notFound = false ;
75+ _baseUrl = (Configuration [" PUBLIC_BASE_URL" ] ?? " " ).TrimEnd ('/' );
6076
6177 _record = await ConvexService .QueryAsync <UploadRecord ?>(
6278 " images:getBySlug" ,
Original file line number Diff line number Diff line change 11@using UndefinedLabs .Models
22@inject ConvexService ConvexService
3+ @inject IConfiguration Configuration
34@page " /t/{Slug}"
45
56<PageTitle >Text - @Slug </PageTitle >
67
8+ @if (_record is not null )
9+ {
10+ <HeadContent >
11+ <meta property =" og:type" content =" website" />
12+ <meta property =" og:title" content =" @_record.FileName" />
13+ <meta property =" og:description" content =" Text - @FormatBytes(_record.FileSize)" />
14+ <meta property =" og:url" content =" @_baseUrl/t/@Uri.EscapeDataString(Slug)" />
15+ </HeadContent >
16+ }
17+
718@if (_notFound )
819{
920 <NotFound />
3748 private UploadRecord ? _record ;
3849 private string _textContent = string .Empty ;
3950 private bool _notFound ;
51+ private string _baseUrl = string .Empty ;
4052
4153 protected override async Task OnParametersSetAsync ()
4254 {
4355 _record = null ;
4456 _textContent = string .Empty ;
4557 _notFound = false ;
58+ _baseUrl = (Configuration [" PUBLIC_BASE_URL" ] ?? " " ).TrimEnd ('/' );
4659
4760 _record = await ConvexService .QueryAsync <UploadRecord ?>(
4861 " texts:getBySlug" ,
You can’t perform that action at this time.
0 commit comments