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

url_for is returning the wrong url #1773

Closed
JBaczuk opened this issue Feb 23, 2016 · 2 comments
Closed

url_for is returning the wrong url #1773

JBaczuk opened this issue Feb 23, 2016 · 2 comments
Labels
question Needs help in usage theme

Comments

@JBaczuk
Copy link

JBaczuk commented Feb 23, 2016

I created a new page which added a folder to the source folder called about. The about folder contains an index folder with assets, and an index.md file. When I run hexo server, url_for(path) in the header.ejs file on the homepage returns /index.html. But, when I run hexo generate, url_for(path) on the homepage returns /about/index.html. I tested this by adding

<%- url_for(path) %>

to header.ejs right under the comment that logs message_isHome to the console.

@jeffa00
Copy link

jeffa00 commented Mar 31, 2016

I have a possibly related issue.

I've added the following to my header.ejs file (my own custom layout):

<!-- <%- path %> -->
<!-- <%- url %> -->
<!-- <%- page.path %> -->
<!-- <%- page.title %> -->

When I run hexo server I get:

<!-- contact/index.html -->
<!--  /contact -->
<!-- contact/index.html -->
<!-- Contact -->

When I run hexo generate here's what I get:

<!-- about-us/index.html
<!--  /about-us -->
<!-- about-us/index.html -->
<!-- About Us -->

This is what I get for every page, not just the contact page.

It's like the page variable isn't being updated for each page when generate is run.

@stevenjoezhang
Copy link
Member

stevenjoezhang commented Mar 4, 2020

This may be related to partial and cache. Please disable caching and check if the problem persists.
See also #2190

@stevenjoezhang stevenjoezhang added question Needs help in usage theme and removed need-verify labels Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Needs help in usage theme
Projects
None yet
Development

No branches or pull requests

4 participants