0

I'm using biblatex with the options backend=biber, style=authoryear, sorting=anyt.

When citing @online resources I want it to only display the year value and not the year listed in urldate. Meaning:

@online{resourceWithYear,
    label           = "Random Label",
    organization    = "Some organization",
    title           = "Lorem Ipsum",
    year            = "2018",
    month           = "April",
    url             = "https://localhost",
    urldate         = "2020-05-11",
}

This \parencite{resourceWithYear} translates to (Random Label 2018).

However using this:

@online{resourceWithNoYear,
    label           = "Other Label",
    organization    = "Some other organization",
    title           = "Consectetur adipisici",
    url             = "https://localhost",
    urldate         = "2020-05-11",
}

\parencite{resourceWithNoYear} Should translate to (Other Label). Right now it displays as (Other Label 2020), using the year value of the urldate tag.

1
  • 1
    Unrelated to your actual question, but I would not use sorting=anyt with style=authoryear,. anyvt sorts primarily by the label that would be generated for the alphabetic style, which you don't use if you say style=authoryear,. If you don't set a sorting manually, style=authoryear, automatically selects sorting=nyt, which is much more sensible here.
    – moewe
    Jul 2, 2020 at 13:59

1 Answer 1

1

The standard answer would be to remove urldate from the \DeclareLabeldate settings

\DeclareLabeldate{%
  \field{date}
  \field{year}
  \field{eventdate}
  \field{origdate}
  \literal{nodate}
}

this would give

(Random Label 2018)

(Other Label n.d.)

because biblatex produces "n.d." if no date can be found.

If you don't want nodate also remove \literal{nodate} from the definition.

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

\usepackage[backend=biber, style=authoryear]{biblatex}

\DeclareLabeldate{%
  \field{date}
  \field{year}
  \field{eventdate}
  \field{origdate}
}

\begin{filecontents}{\jobname.bib}
@online{resourceWithYear,
  label           = {Random Label},
  organization    = {Some organization},
  title           = {Lorem Ipsum},
  year            = {2018},
  month           = apr,
  url             = {https://localhost},
  urldate         = {2020-05-11},
}
@online{resourceWithNoYear,
  label           = {Other Label},
  organization    = {Some other organization},
  title           = {Consectetur adipisici},
  url             = {https://localhost},
  urldate         = {2020-05-11},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}


\begin{document}
\autocite{resourceWithYear,resourceWithNoYear}
\printbibliography
\end{document}

(Random Label 2018; Other Label)

As commented under the question I have removed sortingy=anyvt, so the MWE just uses sorting=nyt.

I have also changed the incorrect month = "April", to month = apr, though I would have preferred date = {2018-04}, instead of year = {2018}, month = apr,.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .