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

if uglyurls = true , the $active is not as expected #9

Open
anbang opened this issue May 8, 2022 · 0 comments
Open

if uglyurls = true , the $active is not as expected #9

anbang opened this issue May 8, 2022 · 0 comments

Comments

@anbang
Copy link

anbang commented May 8, 2022

set uglyurls = true in /config/_default/config.toml
file : /themes/zzodoc/layouts/partials/main/sections/list-menu.html
code :

  {{ $root := .root }}
  {{ $ctx := .ctx }}
  {{ $depth := .depth }}
  <!-- Before: http://localhost:1313/zdoc/gettingstarted/quickstart/ -->
  <!-- Now   : http://localhost:1313/zdoc/gettingstarted/quickstart.html -->
  {{ $currentURL := $root.Permalink }}
  {{ $sectionName1 := index (last 1 (split (delimit (split $ctx.Permalink "/") "," "") ",")) 0 }}
  {{ $sectionName2 := index (last 2 (split (delimit (split $currentURL "/") "," "") ",")) 0 }}
  <!-- $active -->
  {{ $active := in $currentURL $ctx.Permalink }}
  {{ $active = or $active (eq $sectionName1 $sectionName2) }}
  {{ $active = or $active (in $currentURL $sectionName1) }}

EDIT THIS PAGE also has this problem. Can you help? thanks.

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

No branches or pull requests

1 participant