Skip to content

Commit

Permalink
get in touch button dynamic link support - gurusabarish#155
Browse files Browse the repository at this point in the history
  • Loading branch information
gurusabarish committed Mar 9, 2024
1 parent 68eb034 commit 4687d53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion exampleSite/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ params:
enable: true
# title: "Custom Name"
content: My inbox is always open. Whether you have a question or just want to say hi, I’ll try my best to get back to you!
email: [email protected]
btnName: Mail me
btnLink: mailto:[email protected]
# formspree:
# enable: true # `contact.email` value will be ignored
# formId: abcdefgh # Take it from your form's endpoint, like 'https://formspree.io/f/abcdefgh'
Expand Down
12 changes: 10 additions & 2 deletions layouts/partials/sections/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ <h3 class="text-center">{{ .Site.Params.contact.title | default "Get in Touch" }
</div>
</form>
</div>
{{ else if .Site.Params.contact.email }}
{{ else if or (.Site.Params.contact.email) (.Site.Params.contact.btnLink) }}
<div class="text-center pt-3">
<a href="mailto:{{ .Site.Params.contact.email }}" class="btn">
<a
href='{{ if .Site.Params.contact.btnLink }}
{{ .Site.Params.contact.btnLink | default "#" }}
{{ else }}
mailto:{{ .Site.Params.contact.email }}
{{ end }}'
target="_blank"
class="btn"
>
{{ .Site.Params.contact.btnName | default "Get in Touch" }}
</a>
</div>
Expand Down

0 comments on commit 4687d53

Please sign in to comment.