Browse Source

fix(metadata): Use 'yes'/'no' for stuff.

jackyalcine 1 month ago
parent
commit
4d85414963
Signed by: Jacky Alciné <yo@jacky.wtf> GPG Key ID: 537A4F904B15268D
2 changed files with 8 additions and 4 deletions
  1. 2
    2
      web/controllers/settings_controller.ex
  2. 6
    2
      web/views/entry_view.ex

+ 2
- 2
web/controllers/settings_controller.ex View File

@@ -190,11 +190,11 @@ defmodule Koype.Web.SettingsController do
190 190
 
191 191
   def apply(conn, %{"component" => "metadata", "silo" => platforms}) do
192 192
     for platform <- ~w(facebook twitter) do
193
-      Koype.Setting.set("metadata:#{platform}", false)
193
+      Koype.Setting.set("metadata:#{platform}", "no")
194 194
     end
195 195
 
196 196
     for platform <- platforms do
197
-      Koype.Setting.set("metadata:#{platform}", true)
197
+      Koype.Setting.set("metadata:#{platform}", "yes")
198 198
     end
199 199
 
200 200
     conn

+ 6
- 2
web/views/entry_view.ex View File

@@ -147,8 +147,12 @@ defmodule Koype.Web.EntryView do
147 147
 
148 148
   def tags(:meta, "entry/view", _assigns) do
149 149
     ~w(description generator itemprop)a
150
-    |> Enum.concat(if Koype.Setting.get("metadata:facebook", false), do: @opengraph_props, else: [])
151
-    |> Enum.concat(if Koype.Setting.get("metadata:twitter", false), do: @twitter_props, else: [])
150
+    |> Enum.concat(
151
+      if Koype.Setting.get("metadata:facebook", "no") == "yes", do: @opengraph_props, else: []
152
+    )
153
+    |> Enum.concat(
154
+      if Koype.Setting.get("metadata:twitter", "no") == "yes", do: @twitter_props, else: []
155
+    )
152 156
   end
153 157
 
154 158
   def tags(:meta, "entry/gone", _assigns), do: ~w(author)a

Loading…
Cancel
Save