@ -99,6 +99,8 @@ namespace Volo.Docs.Pages.Documents.Project
public bool HasDownloadPdf { get ; set ; }
public bool HasDownloadPdf { get ; set ; }
public DocumentNavigationsDto DocumentNavigationsDto { get ; private set ; }
public DocumentNavigationsDto DocumentNavigationsDto { get ; private set ; }
public DocumentSeoDto DocumentSeoDto { get ; private set ; }
private const int MaxDescriptionMetaTagLength = 2 0 0 ;
private const int MaxDescriptionMetaTagLength = 2 0 0 ;
private const int TocLevelCount = 2 ;
private const int TocLevelCount = 2 ;
@ -542,7 +544,7 @@ namespace Volo.Docs.Pages.Documents.Project
DocumentNameWithExtension = Document . Name ;
DocumentNameWithExtension = Document . Name ;
SetDocumentPageTitle ( ) ;
SetDocumentPageTitle ( ) ;
await ConvertDocumentContentToHtmlAsync ( ) ;
await ConvertDocumentContentToHtmlAsync ( ) ;
return true ;
return true ;
}
}
@ -587,6 +589,7 @@ namespace Volo.Docs.Pages.Documents.Project
var partialTemplates = await GetDocumentPartialTemplatesAsync ( ) ;
var partialTemplates = await GetDocumentPartialTemplatesAsync ( ) ;
DocumentNavigationsDto = await _ webDocumentSectionRenderer . GetDocumentNavigationsAsync ( Document . Content ) ;
DocumentNavigationsDto = await _ webDocumentSectionRenderer . GetDocumentNavigationsAsync ( Document . Content ) ;
DocumentSeoDto = await _ webDocumentSectionRenderer . GetDocumentSeoAsync ( Document . Content ) ;
try
try
{
{
@ -600,11 +603,12 @@ namespace Volo.Docs.Pages.Documents.Project
else
else
{
{
DocumentNavigationsDto = new DocumentNavigationsDto ( ) ;
DocumentNavigationsDto = new DocumentNavigationsDto ( ) ;
}
DocumentSeoDto = new DocumentSeoDto ( ) ;
}
if ( Document ! = null & & ! Document . Content . IsNullOrEmpty ( ) )
{
if ( Document ! = null & & ! Document . Content . IsNullOrEmpty ( ) )
TocItems = _ tocGeneratorService . GenerateTocItems ( Document . Content , TocLevelCount ) ;
{
TocItems = _ tocGeneratorService . GenerateTocItems ( Document . Content , TocLevelCount ) ;
}
}
var converter = _d ocumentToHtmlConverterFactory . Create < DocumentToHtmlConverterContext > ( Document . Format ? ? Project . Format ) ;
var converter = _d ocumentToHtmlConverterFactory . Create < DocumentToHtmlConverterContext > ( Document . Format ? ? Project . Format ) ;
@ -888,6 +892,11 @@ namespace Volo.Docs.Pages.Documents.Project
return null ;
return null ;
}
}
if ( DocumentSeoDto ? . Description . IsNullOrWhiteSpace ( ) = = false )
{
return DocumentSeoDto . Description ;
}
var firstParagraph = new Regex ( @"<p>(.*?)</p>" , RegexOptions . IgnoreCase ) ;
var firstParagraph = new Regex ( @"<p>(.*?)</p>" , RegexOptions . IgnoreCase ) ;
var match = firstParagraph . Match ( Document . Content ) ;
var match = firstParagraph . Match ( Document . Content ) ;
if ( ! match . Success )
if ( ! match . Success )