-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add note on absolute links #2507
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jingting1412 thanks for the work!
I think this issue about using baseUrl isn't just applicable to includes. It also affects panels, modals etc which use links.
Could you update those areas also? Gentle reminder to use includes to avoid duplication.
Would be also good to add it to troubleshooting section in our user guide
Yep for sure! I've added the tip in more places where I think its relevant and the troubleshooting section. Do let me know if I need to refine my explanation or add the tip to more places. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jingting1412 thanks for the work! Some nits :)
docs/userGuide/syntax/includes.md
Outdated
<div id="baseUrl-warning"> | ||
<box type="warning" header="Add `{{ '{{ baseUrl }}' }}` to local URLs to always point to the same target!"> | ||
|
||
For links within `<include>` to always point to the same target, make it an absolute link with `{{ '{{ baseUrl }}' }}` included. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you include a negative example so users know what what not to do as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep sure included! lmk if its not clear or anything
docs/userGuide/troubleshooting.md
Outdated
To solve this, change the relative URL into an **absolute** URL by adding `{{ '{{ baseUrl }}' }}`. This will ensure that the link will always point to the same address regardless of the page it is included in. | ||
|
||
###### Example: Adding `{{ '{{ baseUrl }}' }}` to make absolute URLs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a box here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep sure I have included it now!
docs/userGuide/troubleshooting.md
Outdated
###### Example: Adding `{{ '{{ baseUrl }}' }}` to make absolute URLs | ||
|
||
If file `folder1/file1.md` contains an absolute link `{{ '{{ [link]({{ baseUrl }}/folder1/target.html) }} ' }}`, when `file1.md` is included in `folder2/file2.md`, the link will point to `folder1/target1.html` even if the target is not in the same directory as `file2.md`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is the same as other parts. Could we use includes to reduce duplication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep sure, the example can now be included using includes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using include from the include
section, I was thinking whether we should create one that is more generic since user may be confused by the mentions of include? Wdyt? @jingting1412 @yucheng11122017
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jingting1412 thanks for the work! I think the formatting and so on is good.
I would prefer a more concrete example for the example we provide though (see suggestions). What do you think!
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not so sure on the look of the box.
Based off of @EltonGohJH 's comments, I added some suggestions on how to rephrase it so it sounds a bit more generic...
@@ -71,6 +71,8 @@ | |||
</variable> | |||
</include> | |||
|
|||
<include src="includes.md#baseUrl-warning"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep sure, I've put the example into a panel and changed the explanation to make it more clear! I think since this issue is about links breaking when being included with <include>
, the note at the includes section in the UG and troubleshooting section is also just about this specific problem.
If there's another cause to the link breaking issue other than include
I think we can make a more generic one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for some nits :)
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
@jingting1412 hi, refer to this image for what i mean about weird spacing... could you add a new line where it makes sense to avoid this kind of 0 margin case? And this warning is redundant. Thanks! |
Hi thanks for the spot! I've fixed those areas now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tim-Siu Each PR must have a SEMVER impact label, please remember to label the PR properly. |
What is the purpose of this pull request?
Overview of changes:
#9 and #278
When including contents with links,
{{baseUrl}}
is required to be added to the link if the user wants it to point to the absolute location. Without this note, some users might not realise this can result in broken links as shown in issue #278Anything you'd like to highlight/discuss:
Testing instructions:
markbind serve -d
the docs the see if the warning message under the includes section is clear.Proposed commit message: (wrap lines at 72 characters)
Add note on URLs in includes
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major
,r.Minor
,r.Patch
.Breaking change release note preparation (if applicable):