A heavily used feature in your Stacks site is the ability to add links that allow your users/patrons to access Stacks content and pages, as well as external websites. Understanding the URLs that need to be added to link fields to direct your users/patrons to this content is crucial. This article will take a closer look at URLs and discuss how they work with your Stacks site.
What is a URL?
A simple definition of a URL is that it is a string of characters which is used to identify the location of a resource on the internet. Going a little deeper, URLs are a fundamental component of the internet and are used extensively to access resources on the internet, such as web pages, images, videos, and other types of files. By entering a URL into a web browser or clicking on a hyperlink, users can access the resource identified by the URL.
A simple URL example could look like this: https://www.stacks4libraries.com/about-us
URLs typically consist of several components, including a protocol (HTTP or HTTPS), a domain name (www.stacks4libraries.com), a path (/about-us), and sometimes a query string or fragment identifier.
Absolute vs. Relative URLs
Absolute URLs
An absolute URL is a complete web address that includes all the necessary information to locate a specific resource on the internet; this includes the protocol, domain name, path, and filename of the resource, as well as any query strings or fragment identifiers. Absolute URLs are useful when linking to resources on external websites or when specifying a fixed location for a resource on your own website.
An example of an absolute URL is the example we gave above: https://www.stacks4libraries.com/about-us. This URL contains all the required elements, the protocol "HTTPS", the domain name "stacks4libraries.com", and the path "/about-us".
Relative URLs
A relative URL is a web address that only includes a portion of the necessary information to locate a specific resource on the internet. A relative URL specifies the location of a resource relative to the current page or directory, rather than providing a complete and unambiguous reference to the resource.
Using our previous example, a relative URL to an page within our Stacks sample site is "/about-us". This URL only includes the path and filename of the resource.
Publishing Workflow URL alias
Each page and content block in Stacks is assigned a node path that can be read by machines in addition to a human-readable alias based on the content's title. If this generated alias is not suitable, administrators have the option to define a custom URL alias that will be used instead of the node path or the auto-generated URL.
To use a customized URL alias:
- Navigate to the appropriate tile in the dashboard for the content type you are creating or editing
- Click Add New or locate the content from the list if editing existing content
- In the Publishing workflow expand the URL alias section.
- Uncheck the option "Generate automatic URL alias"
- In the URL alias field enter your desired alternate path with a leading forward-slash (/), for example, if you want a page url to be www.yourwebsite.com/about-us, type: /about-us