Skip to content

Commit

Permalink
Use meta-description instead of description in templates.
Browse files Browse the repository at this point in the history
Since this is an attribute value, we need to prepare it
in the writer.
  • Loading branch information
jgm committed Dec 28, 2020
1 parent 528b67d commit 99e1b67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions data/templates/default.html4
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ $endif$
$if(keywords)$
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
$endif$
$if(description)$
<meta name="description" content="$description$" />
$if(description-meta)$
<meta name="description" content="$description-meta$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
<style type="text/css">
Expand Down
4 changes: 2 additions & 2 deletions data/templates/default.html5
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ $endif$
$if(keywords)$
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
$endif$
$if(description)$
<meta name="description" content="$description$" />
$if(description-meta)$
<meta name="description" content="$description-meta$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
<style>
Expand Down
3 changes: 3 additions & 0 deletions src/Text/Pandoc/Writers/HTML.hs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ pandocToHtml opts (Pandoc meta blocks) = do
let stringifyHTML = escapeStringForXML . stringify
let authsMeta = map stringifyHTML $ docAuthors meta
let dateMeta = stringifyHTML $ docDate meta
let descriptionMeta = escapeStringForXML $
lookupMetaString "description" meta
slideVariant <- gets stSlideVariant
let sects = adjustNumbers opts $
makeSections (writerNumberSections opts) Nothing $
Expand Down Expand Up @@ -352,6 +354,7 @@ pandocToHtml opts (Pandoc meta blocks) = do
defField "author-meta" authsMeta .
maybe id (defField "date-meta")
(normalizeDate dateMeta) .
defField "description-meta" descriptionMeta .
defField "pagetitle"
(stringifyHTML . docTitle $ meta) .
defField "idprefix" (writerIdentifierPrefix opts) .
Expand Down

0 comments on commit 99e1b67

Please sign in to comment.