From bc871169f0c457fdda7bf8a9431373981b3f4a84 Mon Sep 17 00:00:00 2001 From: Ayush Chaurasia Date: Mon, 19 Feb 2024 14:07:31 +0530 Subject: [PATCH] docs: Add meta tag for image preview (#988) I think this should work. Need to deploy it to be sure as it can be tested locally. Can be tested here. 2 things about this solution: * All pages have a same meta tag, i.e, lancedb banner * If needed, we can automatically use the first image of each page and generate meta tags using the ultralytics mkdocs plugin that we did for this purpose - https://github.com/ultralytics/mkdocs --- docs/mkdocs.yml | 1 + docs/src/extra_js/meta_tag.js | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 docs/src/extra_js/meta_tag.js diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index cf9fcde8..62e446be 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -205,6 +205,7 @@ extra_css: extra_javascript: - "extra_js/init_ask_ai_widget.js" + - "extra_js/meta_tag.js" extra: analytics: diff --git a/docs/src/extra_js/meta_tag.js b/docs/src/extra_js/meta_tag.js new file mode 100644 index 00000000..b1349980 --- /dev/null +++ b/docs/src/extra_js/meta_tag.js @@ -0,0 +1,6 @@ +window.addEventListener('load', function() { + var meta = document.createElement('meta'); + meta.setAttribute('property', 'og:image'); + meta.setAttribute('content', '/assets/lancedb_and_lance.png'); + document.head.appendChild(meta); + }); \ No newline at end of file