[Tex/LaTex] Biblatex electronic source

biblatex

This electronic source

\documentclass{article} 

\usepackage[backend = biber, style=authoryear, uniquename=false]{biblatex} 
\addbibresource{ref.bib} 

\usepackage{filecontents} 
\begin{filecontents}{ref.bib} 

@Electronic{Friston2,
  author    = {K. J. Friston},
  year      = {2011}
  url       = {http://www.fil.ion.ucl.ac.uk/spm/course/video/},
  timestamp = {2017.04.24}
  }

\end{filecontents} 

\begin{document}

\textcite{Friston2}

\printbibliography

\end{document}

appears like this in the bibliography: K. J. Friston (2011). Introduction to SPM. http://…
but it should be like: Friston, K. J. (2011). Introduction to SPM. http://…

And when I textcite, it's like this: K. J. Friston, (2011) instead of: Friston (2011)

What am I doing wrong?

Best Answer

The proper format for names in the .bib file is:

LastName, FirstName and LastName, I. I.

For a single name you can get away with FirstName LastName but it's better not to.

Here's your example (I added a comma after the year in the .bib file.)

\documentclass{article} 

\usepackage[style=authoryear, uniquename=false]{biblatex} 
\addbibresource{\jobname.bib} 

\usepackage{filecontents} 
\begin{filecontents}{\jobname.bib} 

@Electronic{Friston2,
  author    = {Friston, K. J. },
  year      = {2011},
  url       = {http://www.fil.ion.ucl.ac.uk/spm/course/video/},
  timestamp = {2017.04.24}
  }
\end{filecontents} 

\begin{document}

\textcite{Friston2}

\printbibliography

\end{document}

output of code