Search code examples
markdowndocusaurus

Add a link to an image or an caption


I'm writing a document in Docusaurus V2.

I understand (from here) that we could insert an image by

<!-- reference static/img/docusaurus.png -->
![Docusaurus logo](/img/docusaurus.png)

Or

// reference static/img/slash-birth.png
<img src="/img/slash-birth.png" alt="docusaurus mascot" />

But now, I would like to add a URL to the image, such that clicking on the image or its caption could open the URL in a browser. Is it possible to implement this in Docusaurus?


Solution

  • Just use the standard html anchor tag

    <a href=“www.google.com”>
    <img src="/img/slash-birth.png" alt="docusaurus mascot" />
    </a>