Footnote punctuation

Hi there, using MHRA Style, in the Footnote template, how do you make the comma after the date conditional on the pages cited field being populated.

Here is a first footnote entry which shows the comma after the date, and then the page cited.  This is is fine.

[1] Mark Houlahan, ‘Dear Hamilton…’, Waikato Times, 30 August 2015, p. 5.

When there is no page reference, the comma after the date stays, but I would like it to be a full stop

1] Mark Houlahan, ‘Dear Hamilton…’, Waikato Times, 30 August 2015,

Attached is a screen shot of what my footnote template looks like - can you please advise me where to fix it?

Many thanks, Anne Ferrier-Watson, Academic Liaison Librarian at University of Waikato, New Zealand