Fix LinkedIn social preview to show Ossie logo instead of Alation logo (#7)
diff --git a/docs/assets/images/ossie-logos/ossie-social-card.png b/docs/assets/images/ossie-logos/ossie-social-card.png
new file mode 100644
index 0000000..1e43b21
--- /dev/null
+++ b/docs/assets/images/ossie-logos/ossie-social-card.png
Binary files differ
diff --git a/hooks/add_og_meta.py b/hooks/add_og_meta.py
new file mode 100644
index 0000000..098ff63
--- /dev/null
+++ b/hooks/add_og_meta.py
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Injects og:image and twitter:image meta tags into every page so that
+# LinkedIn and other social platforms show the Ossie logo when a link
+# to the site is shared.
+
+def on_post_page(output, page, config, **kwargs):
+ site_url = config.get("site_url", "").rstrip("/") + "/"
+ og_image = f"{site_url}assets/images/ossie-logos/ossie-social-card.png"
+ tags = (
+ f' <meta property="og:image" content="{og_image}" />\n'
+ f' <meta property="og:image:type" content="image/png" />\n'
+ f' <meta name="twitter:image" content="{og_image}" />\n'
+ f' <meta name="twitter:card" content="summary_large_image" />\n'
+ )
+ return output.replace("</head>", tags + "</head>", 1)
diff --git a/mkdocs.yml b/mkdocs.yml
index 61b7f5e..0fe66ce 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -132,6 +132,7 @@
# ---------------------------------------------------------------------------
hooks:
- hooks/load_data.py
+ - hooks/add_og_meta.py
# - hooks/fetch_spec.py # TODO: re-enable when spec rendering is reimplemented
# ---------------------------------------------------------------------------