diff --git a/code/model/BlogPost.php b/code/model/BlogPost.php
index c50e86c..bfbe4f4 100644
--- a/code/model/BlogPost.php
+++ b/code/model/BlogPost.php
@@ -371,7 +371,8 @@ class BlogPost extends Page {
foreach($authors as $author) {
$item = new ArrayData(array(
'Name' => $author->Name,
- 'Join' => '',
+ 'IsAndJoin' => false,
+ 'IsCommaJoin' => false,
'URL' => '',
));
@@ -398,7 +399,8 @@ class BlogPost extends Page {
foreach($authors as $author) {
$item = new ArrayData(array(
'Name' => $author,
- 'Join' => '',
+ 'IsAndJoin' => false,
+ 'IsCommaJoin' => false,
'URL' => ''
));
@@ -419,17 +421,18 @@ class BlogPost extends Page {
$count = count($items);
for($i = 0; $i < $count; $i++) {
- if($count === 2 && $i > 0) {
- $items[$i]->Join = ' and ';
+ if($count === 2 && $i === 1) {
+ $items[$i]->IsAndJoin = true;
}
if($count > 2) {
if($i > 0) {
- $items[$i]->Join = ', ';
+ $items[$i]->IsCommaJoin = true;
}
if($i + 1 === $count) {
- $items[$i]->Join = ' and ';
+ $items[$i]->IsCommaJoin = false;
+ $items[$i]->IsAndJoin = true;
}
}
}
diff --git a/templates/Includes/EntryMeta.ss b/templates/Includes/EntryMeta.ss
index 93fec06..dd706f0 100644
--- a/templates/Includes/EntryMeta.ss
+++ b/templates/Includes/EntryMeta.ss
@@ -25,6 +25,6 @@
<% if $Credits %>
<%t Blog.By "by" %>
- <% loop $Credits %><% if $URL %>$Join$Name.XML<% else %>$Join$Name.XML<% end_if %><% end_loop %>
+ <% loop $Credits %><% if $URL %><% if $IsAndJoin %><%t Blog.Join.And " and " %><% end_if %><% if $IsCommaJoin %><%t Blog.Join.Comma ", " %><% end_if %>$Name.XML<% else %><% if $IsAndJoin %><%t Blog.Join.And " and " %><% end_if %><% if $IsCommaJoin %><%t Blog.Join.Comma ", " %><% end_if %>$Name.XML<% end_if %><% end_loop %>
<% end_if %>