Shortening URL string to only include domain name

Hi All,

I’m new to using the CSL editor, and I’m hoping to include shortened URLS, e.g. “” in the footnote citation, whereas I want to use the full URL in the bibliography. I noted that the variable “URL” helpfully has a form “short”, however when I use it with various URLs it doesn’t seem to do any shortening at all. Are implicit usage requirements to get it to work? Or any ideas why it’s not shortening the URLs?



I don’t think there’s a way to specify the short form of a URL in the input data.

To shorten the URL string to only include the domain name in the footnote citation, you can use a combination of the substring and indexOf functions in JavaScript.

Here is an example of how you can use these functions to extract the domain name from a URL:

// define the URL
let url = "";

// find the index of the "://" substring
let index = url.indexOf("://");

// extract the domain name by starting at the index of "://" and taking everything up to the next "/" character
let domain = url.substring(index + 3, url.indexOf("/", index + 3));

// output the shortened URL
console.log(domain); // outputs ""

You can then use this shortened URL in the footnote citation, and use the full URL in the bibliography.