Skip to content

Commit

Permalink
Add site.text defaults to includes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashawley committed Feb 10, 2019
1 parent ce6ae58 commit a79c351
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions _includes/ajaxify_content_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
sendButton.addEventListener('click', function(event){
event.preventDefault();

sendButton.innerHTML = '{{ site.text.contact.ajax.sending }}';
sendButton.innerHTML = '{{ site.text.contact.ajax.sending | default: "sending..." }}';

var xhr = new XMLHttpRequest();
xhr.open('POST', '//formspree.io/{{ site.email }}', true);
Expand All @@ -20,10 +20,10 @@

xhr.onloadend = function (res) {
if (res.target.status === 200){
sendButton.innerHTML = '{{ site.text.contact.ajax.sent }}';
sendButton.innerHTML = '{{ site.text.contact.ajax.sent | default: "Message sent!" }}';
}
else {
sendButton.innerHTML = '{{ site.text.contact.ajax.error }}';
sendButton.innerHTML = '{{ site.text.contact.ajax.error | default: "Error!" }}';
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<!-- Open Graph -->
<!-- From: https://github.com/mmistakes/hpstr-jekyll-theme/blob/master/_includes/head.html -->
<meta property="og:locale" content="{{ site.text.og_locale }}">
<meta property="og:locale" content="{{ site.text.og_locale | default: "en_US" }}">
<meta property="og:type" content="article">
<meta property="og:title" content="{% if page.title %}{{ page.title | xml_escape }}{% else %}{{ site.title | xml_escape }}{% endif %}">
<meta property="og:description" content="{% if page.description %}{{ page.description | xml_escape }}{% else %}{{ site.description | xml_escape }}{% endif %}">
Expand Down
10 changes: 5 additions & 5 deletions _includes/pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
<div class="left">
{% if paginator.previous_page %}
{% if paginator.page == 2 %}
<a class="pagination-item" href="{{ "/" | relative_url }}">{{ site.text.pagination.newer }}</a>
<a class="pagination-item" href="{{ "/" | relative_url }}">{{ site.text.pagination.newer | default: "Newer" }}</a>
{% else %}
<a class="pagination-item" href="{{ paginator.previous_page_path | relative_url }}">{{ site.text.pagination.newer }}</a>
<a class="pagination-item" href="{{ paginator.previous_page_path | relative_url }}">{{ site.text.pagination.newer | default: "Older" }}</a>
{% endif %}
{% else %}
<span class="pagination-item disabled">{{ site.text.pagination.newer }}</span>
<span class="pagination-item disabled">{{ site.text.pagination.newer | default: "Newer" }}</span>
{% endif %}
</div>
<div class="right">
{% if paginator.next_page %}
<a class="pagination-item" href="{{ paginator.next_page_path | relative_url }}">{{ site.text.pagination.older }}</a>
<a class="pagination-item" href="{{ paginator.next_page_path | relative_url }}">{{ site.text.pagination.older | default: "Older" }}</a>
{% else %}
<span class="pagination-item disabled">{{ site.text.pagination.older }}</span>
<span class="pagination-item disabled">{{ site.text.pagination.older | default: "Older" }}</span>
{% endif %}
</div>
<div class="pagination-meta">Page {{ paginator.page }} of {{ paginator.total_pages }}</div>
Expand Down
20 changes: 10 additions & 10 deletions _includes/share_buttons.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<div class="share-page">
{{ site.text.share_buttons.text }}
{{ site.text.share_buttons.text | default: "Share this post!" }}

<div class="share-links">
{% if site.share_facebook %}
<a class="fa fa-facebook" href="https://facebook.com/sharer.php?u={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.facebook }}"></a>
<a class="fa fa-facebook" href="https://facebook.com/sharer.php?u={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.facebook | default: "Share on Facebook" }}"></a>
{% endif %}

{% if site.share_twitter %}
<a class="fa fa-twitter" href="https://twitter.com/intent/tweet?text={{ page.title | cgi_escape }}&amp;url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.twitter }}"></a>
<a class="fa fa-twitter" href="https://twitter.com/intent/tweet?text={{ page.title | cgi_escape }}&amp;url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.twitter | default: "Share on Twitter" }}"></a>
{% endif %}

{% if site.share_googleplus %}
<a class="fa fa-google-plus" href="https://plus.google.com/share?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.googleplus }}"></a>
<a class="fa fa-google-plus" href="https://plus.google.com/share?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.googleplus | default: "Share on Google+" }}"></a>
{% endif %}

{% if site.share_linkedin %}
<a class="fa fa-linkedin" href="http://www.linkedin.com/shareArticle?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;title={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.linkedin }}"></a>
<a class="fa fa-linkedin" href="http://www.linkedin.com/shareArticle?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;title={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.linkedin | default: "Share on LinkedIn" }}"></a>
{% endif %}

{% if site.share_digg %}
<a class="fa fa-digg" href="http://digg.com/submit?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;title={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.digg }}"></a>
<a class="fa fa-digg" href="http://digg.com/submit?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;title={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.digg | default: "Share on Digg" }}"></a>
{% endif %}

{% if site.share_tumblr %}
<a class="fa fa-tumblr" href="http://www.tumblr.com/share/link?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;name={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.tumblr }}"></a>
<a class="fa fa-tumblr" href="http://www.tumblr.com/share/link?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;name={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.tumblr | default: "Share on Tumblr" }}"></a>
{% endif %}

{% if site.share_reddit %}
<a class="fa fa-reddit" href="http://reddit.com/submit?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;title={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.reddit }}"></a>
<a class="fa fa-reddit" href="http://reddit.com/submit?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;title={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.reddit | default: "Share on Reddit" }}"></a>
{% endif %}

{% if site.share_stumbleupon %}
<a class="fa fa-stumbleupon" href="http://www.stumbleupon.com/submit?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;title={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.stumbleupon }}"></a>
<a class="fa fa-stumbleupon" href="http://www.stumbleupon.com/submit?url={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;title={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.stumbleupon | default: "Share on StumbleUpon" }}"></a>
{% endif %}

{% if site.share_hackernews %}
<a class="fa fa-hacker-news" onclick="parent.postMessage('submit','*')" href="https://news.ycombinator.com/submitlink?u={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;t={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.hackernews }}"></a>
<a class="fa fa-hacker-news" onclick="parent.postMessage('submit','*')" href="https://news.ycombinator.com/submitlink?u={{ site.url | cgi_escape }}{{ page.url | cgi_escape }}&amp;t={{ page.title | cgi_escape }}" rel="nofollow" target="_blank" title="{{ site.text.share_buttons.hackernews | default: "Share on Hacker News" }}"></a>
{% endif %}
</div>
</div>
8 changes: 4 additions & 4 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<h1>{{ page.title }}</h1>
<span class="post-meta">{{ page.date | date: site.date_format }}</span><br>
{% if page.update_date %}
<span class="post-meta">{{ site.text.post.updated }}: {{ page.update_date | date: site.date_format }}</span><br>
<span class="post-meta">{{ site.text.post.updated | default: "Updated" }}: {{ page.update_date | date: site.date_format }}</span><br>
{% endif %}
<span class="post-meta small">
{% if page.minutes %}
{{ page.minutes }} {{ site.text.post.minute_read }}
{{ page.minutes }} {{ site.text.post.minute_read | default: "minute read" }}
{% else %}
{{ minutes }} {{ site.text.post.minute_read }}
{{ minutes }} {{ site.text.post.minute_read | default: "minute read" }}
{% endif %}
</span>
</div>
Expand Down Expand Up @@ -55,7 +55,7 @@ <h1>{{ page.title }}</h1>
{% endif %}

{% if site.show_related_posts %}
<h3 class="related-post-title">{{ site.text.post.related_posts }}</h3>
<h3 class="related-post-title">{{ site.text.post.related_posts | default: "Related Posts" }}</h3>
{% for post in site.related_posts %}
<div class="post ml2">
<a href="{{ post.url | relative_url }}" class="post-link">
Expand Down
14 changes: 7 additions & 7 deletions contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@
<form class="form-stacked">
<label>
Email
<input type="text" name="email" class="field-light" placeholder="{{ site.text.contact.email }}">
<input type="text" name="email" class="field-light" placeholder="{{ site.text.contact.email | default: "Email Address" }}">
</label>

<label>
Content
<textarea type="text" name="content" class="field-light" rows="5" placeholder="{{ site.text.contact.content }}" style="resize: vertical"></textarea>
<textarea type="text" name="content" class="field-light" rows="5" placeholder="{{ site.text.contact.content | default: "What would you like to say?" }}" style="resize: vertical"></textarea>
</label>

<input type="text" name="_gotcha" style="display:none" />

<button type='submit' class="button button-blue button-big mobile-block">{{ site.text.contact.submit }}</button>
<button type='submit' class="button button-blue button-big mobile-block">{{ site.text.contact.submit | default: "Say Hello" }}</button>
</form>
{% else %}
<form action="https://formspree.io/{{ site.email }}" method="POST" class="form-stacked">
<label>
Email
<input type="text" name="email" class="field-light" placeholder="{{ site.text.contact.email }}">
<input type="text" name="email" class="field-light" placeholder="{{ site.text.contact.email | default: "Email Address" }}">
</label>
<label>
Content
<textarea type="text" name="content" class="field-light" rows="5" placeholder="{{ site.text.contact.content }}" style="resize: vertical"></textarea>
<textarea type="text" name="content" class="field-light" rows="5" placeholder="{{ site.text.contact.content | default: "What would you like to say?" }}" style="resize: vertical"></textarea>
</label>

<input type="hidden" name="_next" value="{{ site.baseurl }}/thanks/" />
<input type="hidden" name="_subject" value="{{ site.text.contact.subject }}" />
<input type="hidden" name="_subject" value="{{ site.text.contact.subject | default: "New submission!" }}" />
<input type="text" name="_gotcha" style="display:none" />

<input type="submit" class="button button-blue button-big mobile-block" value="{{ site.text.contact.submit }}">
<input type="submit" class="button button-blue button-big mobile-block" value="{{ site.text.contact.submit | default: "Say Hello" }}">
</form>
{% endif %}
</div>
Expand Down

0 comments on commit a79c351

Please sign in to comment.