Selaa lähdekoodia

feat(widget): add appointment booking link to contact widget

Close #828

BREAKING CHANGE

Replace any `\n` with `\\` in the `address` field.
George Cushen 6 vuotta sitten
vanhempi
commit
f2f3177d78
3 muutettua tiedostoa jossa 21 lisäystä ja 3 poistoa
  1. 9 1
      exampleSite/config.toml
  2. 3 0
      i18n/en.yaml
  3. 9 2
      layouts/partials/widgets/contact.html

+ 9 - 1
exampleSite/config.toml

@@ -46,6 +46,7 @@ enableGitInfo = false
   hrefTargetBlank = true  # `true` opens external links in a new tab.
   fractions = true  # `false` disables smart fractions (e.g. 5/12 formatted as a fraction).
   smartypants = true  # `false` disables all smart punctuation substitutions (e.g. smart quotes, dashes, fractions).
+  extensions = ["backslashLineBreak"]
 
 [params]
   # AUTHOR SETUP
@@ -64,12 +65,19 @@ enableGitInfo = false
   # Details for the Contact Widget
   email = "test@example.org"
   address = "Building 1 Room 1, Stanford University, California, 90210, USA"
-  office_hours = "Monday 10:00 to 13:00 or email for appointment"
+  office_hours = """
+  Monday 10:00 to 13:00\\
+  Wednesday 09:00 to 10:00\\
+  Otherwise email to book an appointment
+  """
   phone = "888 888 88 88"
   skype = "echo123"
   telegram = ""
   keybase = ""  # Your keybase.io username.
 
+  # Enter an optional link for booking appointments (e.g. calendly.com).
+  appointment_url = ""
+
   # Discussion link (e.g. link to a forum, mailing list, or chat).
   #   Uncomment line below to use.
   #   discussion = { name = "Discuss", url = "https://discourse.gohugo.io" }

+ 3 - 0
i18n/en.yaml

@@ -112,6 +112,9 @@
 - id: contact_send
   translation: Send
 
+- id: book_appointment
+  translation: Book an appointment
+
 # Publication/Talk details
 
 - id: abstract

+ 9 - 2
layouts/partials/widgets/contact.html

@@ -101,14 +101,21 @@
       {{ with $.Site.Params.address }}
       <li>
         <i class="fa-li fas fa-map-marker fa-2x" aria-hidden="true"></i>
-        <span id="person-address" itemprop="address">{{ replace . "\n" "<br>" | safeHTML }}</span>
+        <span id="person-address" itemprop="address">{{ . | markdownify | emojify }}</span>
       </li>
       {{ end }}
 
       {{ with $.Site.Params.office_hours }}
       <li>
         <i class="fa-li fas fa-clock fa-2x" aria-hidden="true"></i>
-        <span>{{ . }}</span>
+        <span>{{ . | markdownify | emojify }}</span>
+      </li>
+      {{ end }}
+
+      {{ with $.Site.Params.appointment_url }}
+      <li>
+        <i class="fa-li fas fa-calendar-check fa-2x" aria-hidden="true"></i>
+        <a href="{{ . }}" target="_blank" rel="noopener">{{ i18n "book_appointment" | default "Book an appointment" }}</a>
       </li>
       {{ end }}