Cite this page – Widget

The EasyBib cite widget is a simple way of letting your users cite your Web site.

The simplest way to get started is to paste the following block of code into your site:

<script type="text/javascript">

/* <![CDATA[ /
EBcitation = {
"page": document.title,
"site": "Site title",
"url": document.URL,
"date": "January 25th, 2002",
"authors": "John Doe and Karen Kims"
EBversion = "1.0";
document.write(unescape("%3Cscript src='" + EBversion +
]]> */

Take a look at your site, and you should see our blue citation widget show up.

As you can see, we take the values from the EBcitation variable and feed them into our citation service. Then we output the fully-formatted citation to you. The values for EBcitation can either be hardcoded, or dynamically inserted via your server side processing language.

Attribute description

We use the javascript document.title attribute to grab text in the<title></title> tag of the current page. However, you can change this value to anything you want. For instance, if you wanted to use a different page title, you could insert: "page":"Hardcoded page title" or if you wanted to insert a title via PHP, you could have: "page":"<?php echo $page_title; ?>"

“site”:”Site title”
The site title is the domain’s title. For instance, a New York Times article can be titled “Lithium Cell Batteries”, whereas the site title is “New York Times”.

We leverage the javascript document.URL attribute to grab the current URL. However, if you want to use a different URL, or canonical URL, you could include that here instead.

“date”:”January 25th, 2002″
This is the date the page was created, also known as the date of publication. Any string that looks like a date should work here (we use the strtotime() PHP method to convert dates).

“authors”:”John Doe and Karen Kims”
You can include anyone who wrote the piece here. We parse authors using a basic algorithm, so if your authors do not show up properly our parser may not be recognizing your format. The following examples work:

  • John Doe
  • John K. Doe
  • John Kohler Doe
  • John Doe and Karen Kims
  • John Kohler Doe and Karen M. Kims
  • John K. Doe, Karen Kims, and Fred Jones
  • John Doe, Karen Margaret Kims and Fred O’Conner

EBversion = “1.0”
This documents the version you are using. If you leave this blank, we will substitute the latest version of the widget. We recommend keeping this variable in, otherwise your widget’s features may change or break (unlikely, but a possibility).


  • Unless you’re using javascript objects or attributes, make sure to double quote your values
  • In case your strings have double quotes in them, use javascript’s escape() function
  • In case your users do not have javascript, you may want to add a <noscript> tag after widget.

<noscript>Please enable javascript to cite this document</noscript>

The EasyBib widget can leverage our more powerful Citation API as well. To do this, your EBcitation variable will change as follows (note the “raw”:”true” property).

EBcitation = {
/*  ...[JSON values for Citation API].. */

Known issues

  • Currently you can only create one widget per page. We are working on resolving this. (If you try to add two, they overwrite each other).