Skip to content
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

Link the keywords to their respective pages #244

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

AgniveshChaubey
Copy link
Collaborator

@AgniveshChaubey AgniveshChaubey commented May 30, 2024

Addresses #188.

This is an initial PR. Here, I have added a shortcode to link the keywords to their corresponding pages. Please take a look and confirm whether I should proceed with this or not.

@jviotti
Copy link
Member

jviotti commented Jun 3, 2024

Looks great already @AgniveshChaubey ! One small thing: because in the future we might want to link to keywords from older dialects, etc:

  • Can we extend the shortcode to take 2 optional arguments: the dialect name and the vocabulary?
  • If those are not passed, you default to the current dialect as you are doing already

@@ -41,9 +41,9 @@ related:
keyword: unevaluatedProperties
---

The `additionalProperties` keyword is used to control the handling of properties whose names are not listed in the `properties` keyword or match any of the regular expressions in the `patternProperties` keyword. By default any additional properties are allowed.
The {{<keyword-link name="additionalProperties" >}} keyword is used to control the handling of properties whose names are not listed in the {{<keyword-link name="properties" >}} keyword or match any of the regular expressions in the {{<keyword-link name="patternProperties" >}} keyword. By default any additional properties are allowed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we always require a vocabulary name when using the shortcode? As we might be linking to keywords in other vocabularies?

{{- end -}}
{{- $url := index $keywordMap $keyword -}}
{{- if $url -}}
<a href="{{ $url }}">{{ $keyword }}</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hugo has a ref shortcode that ensures the destination is a valid page (thus protecting against broken links): https://gohugo.io/content-management/cross-references/. Can you make use of those here?

@AgniveshChaubey
Copy link
Collaborator Author

I am a bit busy these days, so I haven't had much time to work on this. Let the PR remain open; I'll finish it up whenever I get some free time.

@jviotti
Copy link
Member

jviotti commented Jun 14, 2024

Yeah, no hurries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants