prcr/mkdocs-meta-descriptions-plugin

Incorrect use of <p> text inside <div> as the meta description

prcr opened this issue · 1 comments

prcr commented

Describe the bug
A clear and concise description of what the bug is.

The plugin incorrectly considers the paragraph that contains the title of the admonition as the meta description for a page:

<h1 id="title">Title</h1>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Note text</p>
</div>
<p>This should be used as the meta description</p>

To Reproduce
The list of steps to reproduce the behavior.

Expected behavior
A clear and concise description of what you expected to happen.

The plugin should only consider for the meta description paragraphs that are siblings to the <h1> tag. Decide if in these cases the <div> can be ignored and the next <p> is used, or if no meta description should be deduced from the page content.

Additional context
Add any other context about the problem here.

I identified the issue on this page.

prcr commented

With the current solution the admonition cards are skipped and the next paragraph found after the admonition is used as the meta description for the page.