Image zoom in Docusaurus site
3 minute read
The goal is to add the image zoom capability in your Docusaurus project.
Prerequisites
You must have Docusaurus project on your machine. See my article about installing and configuring Docusaurus.
If you want to use my Docusaurus example site:
-
Fork the GitHub project or clone it to your machine:
-
Install npm dependencies:
-
Run the project on your localhost:
Your Docusaurus site opens in the browser on this localhost: http://localhost:3000/
Add image zoom plugin
To add the docusaurus-plugin-image-zoom
plugin, use the instructions from their npm package page or GitHub repo:
-
Open your project folder in VS Code or any other code editor.
-
Make sure you have the latest version of Docusaurus:
The current latest version is 2.4.1. To update to the latest version:
-
Type this command and press Enter:
Note
The--force
option may be required if you haven’t updated your Docusaurus to the latest version. -
Add the following code to the
docusaurus.config.js
fileplugins
list: -
Add the following code to the
docusaurus.config.js
filethemeConfig
object:
My example Docusaurus project config looks like this:
Click to expand
Test your Docusaurus site locally to see if images are zoomed when you click them. To start your localhost:
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.