How do I get the request URL in hono/jsx? #4435
                  
                    
                      jamesarosen
                    
                  
                
                  started this conversation in
                General
              
            Replies: 1 comment
-
| 
         The Metadata Hoisting section suggests a possible answer: use  app.use('*', async (c, next) => {
  c.setRenderer(content => {
    return c.html(
      <LocationProvider location={c.req.url}>
        <html>
          <head></head>
          <body>{content}</body>
        </html>
      </LocationProvider>
    )
  })
  await next()
})That does change what the page endpoints should render, but overall works pretty well.  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I'm writing a
<Link>component and I want to be able to set (a)aria-current="page"if the link is to the current page being rendered and (b)rel="noopener"if the link is external:I can use a Context to pass the URL down from the top-level page to the
<Link>, but the only way I can think to set it on the context is to pass it in everyc.html(...)call:Can anyone think of a better way to get
c.req.urldown to<Link>?Beta Was this translation helpful? Give feedback.
All reactions