]> Untitled Git - lemmy-ui.git/commitdiff
Converting html tags description field from md to html. Fixes #110
authorDessalines <tyhou13@gmx.com>
Wed, 16 Dec 2020 00:21:08 +0000 (18:21 -0600)
committerDessalines <tyhou13@gmx.com>
Wed, 16 Dec 2020 00:21:08 +0000 (18:21 -0600)
src/shared/components/html-tags.tsx

index 06fd687e9f628f6f11be0132df54908d70457645..ff30fb30a97d4c923a414585d4b17405e4858111 100644 (file)
@@ -1,6 +1,7 @@
 import { Component } from 'inferno';
 import { Helmet } from 'inferno-helmet';
 import { httpExternalPath } from '../env';
+import { md } from '../utils';
 
 interface HtmlTagsProps {
   title: string;
@@ -18,34 +19,37 @@ export class HtmlTags extends Component<HtmlTagsProps, any> {
       <Helmet title={this.props.title}>
         {/* Primary Meta Tags */}
         <meta name="title" content={this.props.title} />
-        {this.props.description && (
-          <meta name="description" content={this.props.description} />
-        )}
 
         {/* Open Graph / Facebook */}
         <meta property="og:type" content="website" />
         <meta property="og:url" content={url} />
         <meta property="og:title" content={this.props.title} />
-        {this.props.description && (
-          <meta property="og:description" content={this.props.description} />
-        )}
-        {this.props.image && (
-          <meta property="og:image" content={this.props.image} />
-        )}
 
         {/* Twitter */}
         <meta property="twitter:card" content="summary_large_image" />
         <meta property="twitter:url" content={url} />
         <meta property="twitter:title" content={this.props.title} />
-        {this.props.description && (
+
+        {/* Optional desc and images */}
+        {this.props.description && [
+          <meta
+            name="description"
+            content={md.renderInline(this.props.description)}
+          />,
+          <meta
+            property="og:description"
+            content={md.renderInline(this.props.description)}
+          />,
           <meta
             property="twitter:description"
-            content={this.props.description}
-          />
-        )}
-        {this.props.image && (
-          <meta property="twitter:image" content={this.props.image} />
-        )}
+            content={md.renderInline(this.props.description)}
+          />,
+        ]}
+
+        {this.props.image && [
+          <meta property="og:image" content={this.props.image} />,
+          <meta property="twitter:image" content={this.props.image} />,
+        ]}
       </Helmet>
     );
   }