Change order of online sources
There are various ways to override the sorting mechanism by adding fields to your .bib
file. The following sorting override fields are available:
presort
sortkey
sortname
sorttitle
sortyear
The presort
field is useful for grouping items, and is not relevant here. The sortkey
field if present will override any other sorting done. The other overrides are more targeted and will override the relevant sorting method if used (author/editor/translator), title or year.
In your case, because you want to order items with the same author and year, you can use a sorttitle
field to your .bib
file with the ordering you want the related entries to appear in. In this example I've put the general page first, by using sorttitle={1}
and the language pages alphabetically by language name, by assigning the sortauthor
appropriately to force that order.
P.S. I don't think that author={Everybody}
is really appropriate for a Wikipedia citation but this is irrelevant to the main point of the question. See Citing Wikipedia.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{lipsum}
\usepackage[margin=1in]{geometry}
\usepackage[style=authoryear,
backend=biber,
giveninits=true,
]{biblatex}
\DeclareLabeldate{%
\field{date}
\field{year}
\field{eventdate}
\field{origdate}
\literal{nodate}
}
\begin{filecontents}[overwrite]{\jobname.bib}
@online{wikipedia-link:General,
author = {Everybody},
title = {Wikipedia! General Website},
url = {https://www.wikipedia.org/},
urldate = {2018-01-31},
sorttitle = {1},
}
@online{wikipedia-link:ITA,
author = {Everybody},
title = {Wikipedia! Italian Language},
url = {https://it.wikipedia.org/wiki/Pagina_principale},
urldate = {2018-01-31},
sorttitle = {3},
}
@online{wikipedia-link:ESP,
author = {Everybody},
title = {Wikipedia! Spanish Language},
url = {https://es.wikipedia.org/wiki/Wikipedia:Portada},
urldate = {2018-01-31},
sorttitle = {4},
}
@online{wikipedia-link:English,
author = {Everybody},
title = {Wikipedia! English Language},
url = {https://en.wikipedia.org/wiki/Main_Page},
urldate = {2018-01-31},
sorttitle = {2},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\textbf{\autocite{wikipedia-link:General}}
\lipsum[1] \textbf{\textcite{wikipedia-link:English}}
\lipsum[1] \textbf{\textcite{wikipedia-link:ESP}}
\lipsum[1] \textbf{\textcite{wikipedia-link:ITA}}
\printbibliography
\end{document}
You can force biblatex
to only consider name, year and citation order for sorting by defining a new sorting themplate. In essence that means that in your citations the first mention of <Name> <year>a
will always come before <Name> <year>b
etc. Your readers may not be able to understand the order of the entries just by looking at the bibliography data (because it is context dependent), but that may not be much of an issue.
Note that I applied the sorting for all entry types, not just @online
, since the general scheme is applicable to other types as well and makes no less sense there.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{lipsum}
\usepackage[backend=biber,
style=authoryear,
sorting=nyorder,
giveninits=true,
]{biblatex}
\DeclareLabeldate{%
\field{date}
\field{year}
\field{eventdate}
\field{origdate}
\literal{nodate}
}
\DeclareSortingTemplate{nyorder}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{sortyear}
\field{year}
}
\sort{\citeorder}
}
\begin{filecontents}{\jobname.bib}
@online{wikipedia-link:General,
author = {Everybody},
title = {Wikipedia! General Website},
url = {https://www.wikipedia.org/},
urldate = {2018-01-31},
}
@online{wikipedia-link:ITA,
author = {Everybody},
title = {Wikipedia! Italian Language},
url = {https://it.wikipedia.org/wiki/Pagina_principale},
urldate = {2018-01-31},
}
@online{wikipedia-link:ESP,
author = {Everybody},
title = {Wikipedia! Spanish Language},
url = {https://es.wikipedia.org/wiki/Wikipedia:Portada},
urldate = {2018-01-31},
}
@online{wikipedia-link:English,
author = {Everybody},
title = {Wikipedia! English Language},
url = {https://en.wikipedia.org/wiki/Main_Page},
urldate = {2018-01-31},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem \autocite{wikipedia-link:General}
ipsum \textcite{wikipedia-link:English}
dolor \textcite{wikipedia-link:ESP}
sit \textcite{wikipedia-link:ITA}
\printbibliography
\end{document}