             }

                results.hits.forEach((hit) => {
                    const resultElement = document.createElement("div");
                    resultElement.className = "result-item";

                    const title = hit._formatted?.title || hit.title;
                    const content = hit._formatted?.content || hit.content;
                    const path = hit.path;
                    const tags = hit.tags || [];

                    resultElement.innerHTML = `
                    <div c