Linking to a file

How to link to a file

To link directly to a file you need to create a Resource for the file. By using the Resource content type for downloadable files, you will have a stable link for the file and be able to include the file in resource lists and search results, as well as assign taxonomy terms to the file. 

If you need to upload a newer version of your file, updating the file within the resource will not cause your link to the file to break.

Step 1: Create a Resource for the file

  1. Use the platform menu to navigate to Content > Add Content > Resource.
  2. Add a name for the file in the Resource Name field. This name will serve as a link to the file on resource lists and search results, and as a name to select when creating a link in Step 2.
  3. From the Resource Type options, choose Download File.
  4. Choose Add Media from the File Attachment section and select a document from the media library or upload a new document (see File Attachments for more details about how to provide and link to file attachments).
  5. Add an optional Excerpt, Thumbnail, and Taxonomy terms for resource lists and search results.
  6. Save the Resource. (See more detailed instructions for working with the Resource content type).

Step 2: Link to a Resource

Once you have created a Resource for the file, you can link to the Resource “node” using the text editor toolbar found on different content types and components. 

You can also link to the Resource from components, including Call to Action Links, Button-Style Cards, and Vertical Cards.

  1. Linking to a file from the text editor:
    1. Select the text to link to the resource. When linking to a downloadable file, include the file type in the link text, e.g., “Course Syllabus (PDF)”.
    2. Select the Link button in the editor toolbar (see Text Editor for details about using the toolbar and text input area).
    3. Enter the first few letters of the name of the Resource in the Link URL input and then select the corresponding content from the autocomplete Content menu (see Internal Links for guidance on how to link to content within a site).
  2. Linking to a file from a component:
    1. Enter a short descriptive name of the linked file in the Link text input. When linking to a downloadable file, include the file type in the link text, e.g., “Course Syllabus (PDF)”.
    2. Enter the first few letters of the name of the Resource in the URL input and then select the corresponding content from the autocomplete URL menu.
  3. Select Save to save the content.
  4. Verify that the file downloads as expected when the link is selected.

How to update a file linked to a resource

Follow these instructions if you need to update an existing file linked to a resource with a newer version. There are two steps involved:

  • Updating the file within the resource.
  • Deleting the file from the Media Library.

Step 1: Update your resource file with a new version

  1. Go to the resource that is linked to the file and edit it.
  2. Scroll down to the File Attachment section and remove the file by clicking on the file remove button (the "x" icon).
  3. Click on Add Media from the File Attachment section and select your new or updated document file from the media library (or upload the new document.)
  4. Save the Resource.

Step 2: Delete the previous file and its media entity

This step completely removes the previous version of your file from your site.

  1. Go to the Media Library under Content.
  2. Search for the previous version of the file you just updated on the step above.
  3. Edit the media entity and file for the old PDF.
  4. Scroll to the bottom of the page and click on the Delete link. The platform will prompt you to delete the media entity and the associated file with it.
     
a modal prompting the user to delete the media entity and associated file

Notes

  • You do not need to swap out the file within the media entity. Do that only on the resource associated with the file. That way, you keep that persistent URL on the resource, as well as any taxonomy and metadata associated with it.
  • Some old files may persist (cached) on our server infrastructure for some time, so it may take up to a few days for the old file to completely disappear. 

How to link to a file (Video)


Related how-tos

Related resources

Content URLs

How content URLs are generated and managed on the platform.

A modern building with a grid-like facade of metallic panels and glass windows.

Internal Links

How to link different types of content and content types within your site

Closeup of a structure of tubes connected to wooden blocks, overlaying a window and buildings beyond.

Support and feedback options for HarvardSites Drupal

Submit a ticket

If you encounter any issues or bugs with the HarvardSites Drupal platform, please submit a ticket through the HUIT Service Desk.

Share website feedback

If you have ideas for how to improve the HarvardSites User Guide website, please submit your ideas using our website feedback form.

Design System How-To Guides

Practical guides and how-tos for using HarvardSites features to build engaging, effective websites that support your department’s goals.

AI Support chatbot

Try our new AI-powered support chatbot to answer questions about the Drupal platform.