Just a small tips and tricks blog post about working with custom layouts in PnP Modern Search Results web parts.
The Results web part comes with a build in result template editor:
However, my preferred way to work with display template is to use the External Template URL:
- Select the out of the box template you intend to customize.
- Grap the base template config from the "Edit result template"
- Paste it into VS Code/Notepad and save it as a HTML file on your PC.
- Upload the file to a document library on your tenant
- Copy the URL of the HTML file (get it from Version history or similar)
- Paste it into the "Use an external template URL" field
- Sync the document library to your PC
- Open the HTML file from the sync'ed document library on your PC using VS Code or similar.
- Update the code and save, and all it takes to see the change is a F5 on the page with the web part.
Easy, right? 👌😊
(And you get all of the modern editor stuff and GitHub Copilot as well)