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

feat: allow overriding prev and next links in frontmatter (#15755) #16044

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

AdeshGhadage
Copy link

@AdeshGhadage AdeshGhadage commented Dec 4, 2024

Description

This pull request introduces a feature allowing content authors to override the prev and next navigation links directly in the front matter of a Hugo page. This PR addresses issue #15755

Reviewers

  • Ambient
  • Docs
  • Installation
  • Networking
  • Performance and Scalability
  • Extensions and Telemetry
  • Security
  • Test and Release
  • User Experience
  • Developer Infrastructure
  • Localization/Translation

@AdeshGhadage AdeshGhadage requested a review from a team as a code owner December 4, 2024 11:39
Copy link

linux-foundation-easycla bot commented Dec 4, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@istio-policy-bot
Copy link

😊 Welcome! This is either your first contribution to the Istio documentation repo, or
it's been a while since you've been here. A few things you should know:

  • You can learn about how we write and maintain documentation, our style guidelines,
    and the available web site features by visiting Contributing to the Docs.

  • In the next few minutes, an automatic preview of your change will be built with
    a full copy of the istio.io website. You can find this preview by clicking on
    the Details link next to the deploy/netlify entry in the status section of this
    page.

  • We care about quality, so we've put in place a number of checks to ensure our documentation
    is top-notch. We do spell checking, sanitize the Markdown, ensure all hyperlinks point to a
    valid location, and more. If your PR doesn't pass one of these checks, you'll see a red X in the
    lint_istio.io entry in the status section. Click on the Details link to get a list of the
    problems with your PR. Fix those problems and push an update; this will automatically re-run the
    tests. Hopefully this time everything will be perfect!

  • Once your changes are accepted and merged into the repository, they will initially show up
    on https://preliminary.istio.io. The changes will be published to https://istio.io
    the next time we do a major release (which typically happens every 3 months or so).
    To publish them sooner, add a cherrypick/release-x.xx label, where x.xx is the current
    release of Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@istio-testing istio-testing added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test labels Dec 4, 2024
@istio-testing
Copy link
Contributor

Hi @AdeshGhadage. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@dhawton
Copy link
Member

dhawton commented Dec 4, 2024

/ok-to-test

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Dec 4, 2024
@dhawton
Copy link
Member

dhawton commented Dec 4, 2024

There was a build failure here, so this PR is not yet ready for review.

@AdeshGhadage
Copy link
Author

I have solved build failure, I am new to istio. any more changed needed?

@craigbox
Copy link
Contributor

craigbox commented Dec 6, 2024

A brief look at this suggests it isn't going to work how we need.
We need to have the original .NextInSection/.PrevInSection behavior (including the same formatting) unless prev or next is set in the front matter,, in which case it should be overridden.

Also, we don't have a reversePagination setting.

@istio-testing istio-testing added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 6, 2024
@craigbox
Copy link
Contributor

Thanks adesh! It looks like it might work but I suspect you've changed which of "next" and "prev" are left and right.
(That's a really awkward thing about Hugo, so don't worry, it's hard to get right. Or left!)

To make the testing easier, it would be worth setting up a couple of next: and prev: in the front matter of some pages. Where I would explicitly suggest you put them:
/docs/ambient/getting-started/ should next: to /docs/ambient/getting-started/deploy-sample-app, and the latter should prev: to the former.

then /docs/ambient/getting-started/cleanup/ could optionally next: to /docs/ambient/install/ and vice versa.

layouts/partials/posts_navigation.html Outdated Show resolved Hide resolved
layouts/partials/posts_navigation.html Outdated Show resolved Hide resolved
layouts/partials/posts_navigation.html Outdated Show resolved Hide resolved
layouts/partials/posts_navigation.html Show resolved Hide resolved
layouts/partials/posts_navigation.html Outdated Show resolved Hide resolved
@AdeshGhadage AdeshGhadage requested a review from a team as a code owner December 12, 2024 12:32
@AdeshGhadage
Copy link
Author

@craigbox The difficulty I faced stemmed from not fully understanding Hugo's multilingual mode. Initially, I tried to provide the URL for a specific language version directly to Site.GetPage, but this didn't work because Hugo resolves paths based on the current language. After learning about multilingual support, I realized I needed to handle language-specific pages properly by including the correct language code in the path. Once I figured this out, I was able to resolve the issue and successfully implement the functionality. I enjoyed learning a lot while solving this challenge!

@craigbox
Copy link
Contributor

LGTM; it's there in EN, it's not there in ZH, it does what we wanted.
Thanks!

I'll approve this once the requested change is made. but I would like to encourage you to think about if there is a way to automate this: if you're on a page with children, then 'next' should be the first child, and the 'prev' should be the last page in the bundle from before.

Don't think too hard, but this demonstrates good pre-work for an upcoming mentorship :)

@@ -8,6 +8,7 @@ aliases:
owner: istio/wg-environment-maintainers
test: n/a
list_below: yes
prev: /docs/ambient/getting-started/cleanup
Copy link
Contributor

Choose a reason for hiding this comment

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

On second thoughts we should remove this; people who find this page don't necessarily come from Getting Started.

Suggested change
prev: /docs/ambient/getting-started/cleanup

@AdeshGhadage
Copy link
Author

LGTM; it's there in EN, it's not there in ZH, it does what we wanted.
Thanks!

I'll approve this once the requested change is made. but I would like to encourage you to think about if there is a way to automate this: if you're on a page with children, then 'next' should be the first child, and the 'prev' should be the last page in the bundle from before.

Don't think too hard, but this demonstrates good pre-work for an upcoming mentorship :)

I currently out on vacation i will do the changes as soon as i get back

@craigbox
Copy link
Contributor

No rush, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user experience kind/docs ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants