# Formatting apalike-url.bst link to reference

I am using apalile-url.bst to get APA references formatting, but I want to format the reference link when I am using a URL, for example when I reference a URL I get.

this is a url reference [StackExchange, ], this is a book reference [Jones, 2001]

As you can see if the URL does not have a year it still uses the [name,year] format, but I want the link to the reference to look like

this is a url reference [StackExchange], this is a book reference [Jones, 2001]

Any ideas on how can I modify the .bst file?

\documentclass[letterpaper,12pt,oneside,onecolumn,final,openany]{report}
\usepackage{url}

\begin{document}

\chapter{Test}

\clearpage
\bibliographystyle{./reference/apalike-url}
\bibliography{./reference/refdatabasewok}

\end{document}


refdatabasewok is

@ELECTRONIC{google,
}

-
What packages are you using to manage the references? Please add a minimal working example (MWE). – Guido Oct 12 '12 at 21:21

The part to modify in the opaline-url.bst file is the function FUNCTION {calculable}. IN my copy of the file starts at line 1137. The function must be modified as follows:

FUNCTION {calc.label}
{ type$"book" = type$ "inbook" =
or
'author.editor.key.label
{ type$"proceedings" = 'editor.key.label 'author.key.label if$
}
if$year empty$  % add this line
if$% add this line % ", " % this is the original line that has to be removed or commented out * year field.or.null purify$ #-1 #4 substring$* 'label := }  The original style inserts ", ", what you have to do is to insert it only if there is a value for year. So you can create a conditional that checks whether there is a value for the year: year empty$ and if there is no value it does not insert anything, and it insert the comma and a space after it, i.e, ", ", if there is a year.
Change the name of the .bst file after you modified it.