瀏覽代碼

:wrench: Set priority of images for metatags

Under the metadata `img` :

1. share
2. main
3. icon

Tip : if no `img` tag is provided in the content metadata, the root
metadata provides a default one with a share img.
DricomDragon 1 年之前
父節點
當前提交
3996ad7227
共有 1 個文件被更改,包括 16 次插入3 次删除
  1. 16 3
      src/templates/main.html

+ 16 - 3
src/templates/main.html

@@ -20,20 +20,33 @@ $endif$
         <!-- Google / Search Engine Tags -->
         <meta itemprop="name" content="$author-meta$">
         <meta itemprop="description" content="$description$">
-        <meta itemprop="image" content="$shareImg$">
 
         <!-- Facebook Meta Tags -->
         <meta property="og:url" content="https://www.jovian-hersemeule.eu">
         <meta property="og:type" content="website">
         <meta property="og:title" content="$title$">
         <meta property="og:description" content="$description$">
-        <meta property="og:image" content="$shareImg$">
 
         <!-- Twitter Meta Tags -->
         <meta name="twitter:card" content="summary_large_image">
         <meta name="twitter:title" content="$title$">
         <meta name="twitter:description" content="$description$">
-        <meta name="twitter:image" content="$shareImg$">
+
+        <!-- Share img -->
+$if(img.share)$
+        <meta itemprop="image" content="$img.share.path$">
+        <meta property="og:image" content="$img.share.path$">
+        <meta name="twitter:image" content="$img.share.path$">
+$elseif(img.main)$
+        <meta itemprop="image" content="$img.main.path$">
+        <meta property="og:image" content="$img.main.path$">
+        <meta name="twitter:image" content="$img.main.path$">
+$elseif(img.icon)$
+        <meta itemprop="image" content="$img.icon.path$">
+        <meta property="og:image" content="$img.icon.path$">
+        <meta name="twitter:image" content="$img.icon.path$">
+$endif$
+
 
         <!-- Meta Tags Generated via http://heymeta.com -->