CloudCannon / pagefind

Static low-bandwidth search at scale
https://pagefind.app
MIT License
3.22k stars 97 forks source link

Support of specific "target" for <a> links by default UI to open result documents in different frame #623

Open IngoHolder opened 1 month ago

IngoHolder commented 1 month ago

When the default UI is integrated into an existing HTML suite that uses frames, it is much more convenient for larger suites when the selected search result link is opened in e.g. a new tab or a specific frame. Therefore, a CLI option "link-target" would be useful. When specified, the given value is added to the generated pagefile-ui.js as target attribute. By setting --link-target _blank the documents are opened in a new tab, by setting --link-target myframe the documents are opened in the given frame.

bglw commented 1 month ago

Good call, that can be added. It'll be an option when constructing the Default UI in the browser though, rather than a CLI option (the CLI is unaware of anything UI-side)

IngoHolder commented 1 month ago

An option in the default UI would be fine for me as well. I just noticed that the default UI is generated as part of the index generation so I thought it could be specified there. I manually adjusted the minimized default UI to specify the target _blank and it makes the default UI much more usable in my setup. However, I have to do a "text editor" replacement after each index generation.