Using baseurl in patterns

Open
#91 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
html
Domain
frontend

Research direction

Start with the default template and the pattern rendering path that expands @root.baseurl; reproduce the shown output for assets/toolkit/images/icons.svg. Done means the generated href uses ../../assets/... rather than ../../../assets/... without hard-coding directory levels.

Written by the indexing model from the issue text.

Description

I saw in the default template {{@root.baseurl}} so I tried to use it in a pattern to point to icons that I added to the assets directory. Using it here adds an extra ../. From what I can tell this happens because @root is the initial context that the template was executed in. Is there a way to use this in a pattern that I am just not seeing or do I have to hard code the directory levels?

I'm using it like this:
<use xlink:href="{{@root.baseurl}}/assets/toolkit/images/icons.svg#{{icon}}" />

and getting
<use xlink:href="../../../assets/toolkit/images/icons.svg#bell" />

when I should get
<use xlink:href="../../assets/toolkit/images/icons.svg#bell" />

Dominant language
HTML
Stars
662
Forks
28
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudfour/drizzle

All issues in cloudfour/drizzle

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.