Render 3D models in the web page generated by Hugo
Render GLTF model with Three.js
I used Hugo to create my blog website. To render 3D models in the pages generated by Hugo, I used three.js. To make it easy to use, I wrapped the code into a shortcode (saved as layouts\shortcodes\model3d.html).
The short code “model3d" has four parameters:
src:GLTF model path ratio:Aspect ratio of the view port, default to 1.7778 grid:Whether to show the grid or not, default to false back_light:Whether to add the back light, default to false {{ $_hugo_config := `{ "version": 1 }` }} {{ $modelPath := .
Posted on Tuesday, February 27, 2024