Skip to content

fix: deprecations warnings Language.LanguageDirection and .site#199

Open
saurabhraghuvanshii wants to merge 1 commit into
layer5io:masterfrom
saurabhraghuvanshii:lang
Open

fix: deprecations warnings Language.LanguageDirection and .site#199
saurabhraghuvanshii wants to merge 1 commit into
layer5io:masterfrom
saurabhraghuvanshii:lang

Conversation

@saurabhraghuvanshii
Copy link
Copy Markdown
Member

Notes for Reviewers

This PR fixes #

Signed commits

  • Yes, I signed my commits.

Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to address deprecation warnings and improve the offline search functionality. In offline-search.js, robust payload normalization and error handling were added. In hugo.yaml, minor formatting and configuration changes were made. However, two issues were identified in the review: the newly added head-css.html template still uses the deprecated .Site.Language.Direction instead of .Language.LanguageDirection, and changing languageName to label in hugo.yaml is non-standard and will break language-related templates.

makes it snappier to develop in Chrome, but it may look sub-optimal in other
browsers. */ -}}

{{ if eq .Site.Language.Direction "rtl" -}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The PR objective is to fix deprecation warnings for Language.LanguageDirection and .site. However, this newly added file still uses the deprecated .Site.Language.Direction. Update it to use .Language.LanguageDirection to resolve the deprecation warning.

Suggested change
{{ if eq .Site.Language.Direction "rtl" -}}
{{ if eq .Language.LanguageDirection "rtl" -}}

Comment thread hugo.yaml
languages:
en:
languageName: English
label: English
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In Hugo, languageName is the standard configuration option used to define the language's display name (accessed via .Language.LanguageName). Changing this to label is not standard in Hugo and will cause .Language.LanguageName to return the language code (e.g., en) or be empty, which breaks language switchers or templates relying on it. Revert this change to keep languageName.

    languageName: English

@github-actions
Copy link
Copy Markdown

🚀 Preview deployment: https://layer5io.github.io/academy-theme/pr-preview/pr-199/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant