Skip to content

How to Link to a Project's Detailed Info Page

Jessica Cheng edited this page Jan 19, 2023 · 20 revisions

The following instructions are for the project files in _projects and use Liquid template language and Jekyll. We will be using code snippets from this example.

  1. Create a variable with a relative pathname using slug and prepending "../projects/". Slug uses the filename of a document and any character except numbers and letters is replaced as [a] hyphen in the filename [https://jekyllrb.com/docs/permalinks/#placeholders].

Example:

Create a variable {% assign project_relative_path = project.slug | prepend: "../projects/" %}

  • {{project.image_alt}} {{project.title}}
    • Created a new variable project_relative_path which was set as the filename of the project using Jekyll's .slug attribute, using a filter to prepend it by "../projects/".
    • Replaced the existing <a> element's href property of the <li class='project-card-mini'> element with the new variable.
  • Clone this wiki locally