Skip to content

Is it possible compage current url with url resolved by resolve_url plugin? #464

Closed Answered by oscarotero
cawa-93 asked this question in Q&A
Discussion options

You must be logged in to vote

Lume provides the url filter out of the box: https://lume.land/plugins/url/#url-filter

You can do this:

export default ({lang, url}, helpers) => {
  const comparedUrl = helpers.url(`~/index.tsx(lang=${lang})`);
  const isCurrentPage = url === comparedUrl

  return <nav>
         <a href={`index.tsx(lang=${lang})`} {...isCurrentPage ? {ariaCurrent: 'page'} : {}}>{goHome}</a>
    </nav>
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by cawa-93
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants