feat: add keywords section to PDF download

Updated the PDF generation process to include article keywords in the downloaded document. Keywords are pulled from post metadata and are displayed in italics below the abstract. This enhances the document's SEO value and improves content discoverability.
This commit is contained in:
Kumi 2024-09-17 15:57:09 +02:00
parent 81d567447b
commit 3c32d5eaf8
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -950,6 +950,14 @@ function handle_pdf_download()
$pdf->writeHTML("<b>Abstract:</b> " . $post->post_excerpt);
}
// Set keywords
$keywords = get_post_meta($post_id, 'article_keywords', true);
if (!empty($keywords)) {
$pdf->Ln(10);
$pdf->SetFont('helvetica', 'I', 12);
$pdf->writeHTML('<b>Keywords:</b> ' . implode(', ', array_map('esc_html', $keywords)));
}
// Set content
$pdf->setTextColor(0);
$pdf->Ln(10);