Biblatex Harvard style: Amend In-Text Referencing

biblatexharvard-style

There is a very similar question to this post but it was never resolved; I couldn't find any quick solution neither, probably because it is a noob issue… Hopefully someone can provide an answer for a confused noob.

Currently biblatex generated author-year style in-text citation like the following:

(Smith 2006 p. 50)

I am looking to add commas between each element of an in-text citation, like so:

(Smith, 2006, p. 50)

My current code for biblatex (I believe most are for modifying the full citation in bibliography, so it'd be helpful to point out where I can edit):

\usepackage[backend=biber,style=ext-authoryear,maxbibnames=99,giveninits=true,innamebeforetitle=true,dashed=false,uniquename=init]{biblatex}
\addbibresource{1.bib}
%force forcing the bib entries not to be split across pages, which is done by setting \interlinepenalty to 10000.
\renewcommand*{\bibsetup}{%
  \interlinepenalty=10000\relax % default is 5000
  \widowpenalty=10000\relax
  \clubpenalty=10000\relax
  \raggedbottom
  \frenchspacing
  \biburlsetup}
% space between biblio items
\setlength\bibitemsep{1.7\itemsep}
%Last-First name order
\DeclareNameAlias{sortname}{family-given}
\DeclareNameAlias{default}{family-given}
% Put editor string in parentheses
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}

\DeclareFieldAlias{translatortype}{editortype}
\DeclareDelimAlias{translatortypedelim}{editortypedelim}

% Print editors before "in" title
\renewbibmacro*{in:}{%
  \setunit{\addcomma\space}%
  \bibstring{in}%
  \printunit{\intitlepunct}}

\DeclareDelimFormat[bib]{innametitledelim}{\addspace}
 
%remove pp in-text citations
\DefineBibliographyStrings{english}{
  page             = {},
  pages            = {},
} 
\renewcommand{\postnotedelim}{\addcolon}

\NewBibliographyString{available}
\DefineBibliographyStrings{english}{
    available = {Available at},
    urlseen = {accessed on}
    andothers = {\em et\addabbrvspace al\adddot}
}
\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space\url{#1}}
\DeclareFieldFormat{urldate}{\addcomma\space\bibstring{urlseen}\space#1}

\renewbibmacro*{name:andothers}{% Based on name:andothers from biblatex.def
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
  }
    {\ifnumgreater{\value{liststop}}{1}
       {\finalandcomma}
       {}%
     \andothersdelim\bibstring[\emph]{andothers}}
    {}}

My 1.bib file:

@book{Smith2006,
publisher = {Routledge},
title = {Uses of heritage},
year = 2006,
author = {Smith, Laurajane},
address = {London},
}

Best Answer

The punctuation between name and year in citations is controlled by the context-sensitive delimiter nameyeardelim. The punctuation between year and the postnote/page range by postnotedelim.

So you probably want something like

\DeclareDelimFormat{nameyeardelim}{\addcomma\space}
\DeclareDelimFormat{postnotedelim}{\addcomma\space}

In total (with a few small changes to make some things more idiomatic, comment if you want hints about that)

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[
  backend=biber,
  style=ext-authoryear,
  maxbibnames=99,giveninits=true,uniquename=init,
  innamebeforetitle=true,
  dashed=false,
]{biblatex}

\renewcommand*{\bibsetup}{%
  \interlinepenalty=10000\relax % default is 5000
  \widowpenalty=10000\relax
  \clubpenalty=10000\relax
  \raggedbottom
  \frenchspacing
  \biburlsetup}

\setlength\bibitemsep{1.7\itemsep}

\DeclareNameAlias{sortname}{family-given}
\DeclareNameAlias{default}{family-given}

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}

\DeclareFieldAlias{translatortype}{editortype}
\DeclareDelimAlias{translatortypedelim}{editortypedelim}


\renewbibmacro*{in:}{%
  \setunit{\addcomma\space}%
  \bibstring{in}%
  \printunit{\intitlepunct}}

\DeclareDelimFormat[bib]{innametitledelim}{\addspace}
 
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}

%remove pp in-text citations
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareDelimFormat{postnotedelim}{\addcomma\space}

\NewBibliographyString{available}
\DefineBibliographyStrings{english}{
  available = {Available at},
  urlseen   = {accessed on}
}

\DefineBibliographyExtras{british}{%
  \DeclareBibstringSet{latin}{andothers,ibidem}%
  \DeclareBibstringSetFormat{latin}{\mkbibemph{#1}}%
}
\UndefineBibliographyExtras{british}{%
  \UndeclareBibstringSet{latin}%
}

\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space\url{#1}}
\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}
\renewbibmacro*{url+urldate}{%
  \usebibmacro{url}%
  \iffieldundef{urlyear}
    {}
    {\setunit*{\addcomma\space}%
     \usebibmacro{urldate}}}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson}
ipsum \autocite[12]{worman}
dolor \autocite{aksin}

\printbibliography
\end{document}

Lorem (Sigfridsson and Ryde, 1998) ipsum (Worman, 2002, 12) dolor (Aksın et al., 2006)