baul
January 22, 2020, 6:15pm
1
mysql table row is
5e23141c945ff06e54c1a343 navigation [{"label":"DjangoCMSBlog","url":"https://www.approachai.com/en/blog-1/"},{"label":"NextBlog","url":"https://nextblog.approachai.com/
"}] blog 2017-11-09 05:16:20 1 2020-01-22 10:13:18 1
and
ghost use the casper theme,and we set first-level navigation as above(delete norelated labeles)
But the navigation item NextBlog show url https://blog.approachai.com ,not https://nextblog.approachai.com , and same as the html source of the webpage.
How do i debug the handlebarsjs template? and What is the problem?
Did you enter this via the Ghost admin?
baul
February 8, 2020, 1:22pm
3
Yes,set In settings—design–NAVIGATION.
ghost v3
I see, would you be able to link to the page so I can debug it?
baul
February 16, 2020, 1:13pm
5
https://blog.approachai.com/ , see the NEXTBLOG nav. it shoulde be nextblog.approachai.com ,but it show blog.approachai.com
What do you meaning link the page?
I alway on twitter @BaulCN , you can reach me.
baul
February 16, 2020, 1:33pm
6
Have clear cdn cache for https://blog.approachai.com/ ,and browser cache.
Can you show the code for the navigation? It looks like Casper was customized a bit.
baul
February 16, 2020, 2:09pm
8
partials/navigation.hbs
<div class="my-fancy-nav-wrapper">
<ul class="nav">
<!-- Loop through the navigation items -->
{{#foreach navigation}}
{{log this}}
<li class="nav-{{slug}}{{#if current}} nav-current{{/if}}"><a href="{{url absolute="true"}}">{{label}}</a></li>
{{/foreach}}
<!-- End the loop -->
</ul>
</div>
cat partials/site-nav.hbs
<nav class="site-nav">
<div class="site-nav-left-wrapper">
<div class="site-nav-left">
{{#if @site.logo}}
<a class="site-nav-logo" href="{{@site.url}}"><img src="{{@site.logo}}" alt="{{@site.title}}" /></a>
{{else}}
<a class="site-nav-logo" href="{{@site.url}}">{{@site.title}}</a>
{{/if}}
<div class="site-nav-content">
{{#if @site.navigation}}
{{log this}}
{{navigation}}
{{/if}}
{{#is "post"}}
<span class="nav-post-title {{#unless @site.logo}}dash{{/unless}}">{{post.title}}</span>
{{/is}}
</div>
</div>
</div>
later content in the file , i just change the twitter link ,it is not related with issue .
baul
February 16, 2020, 2:13pm
9
I add {{ log this}} ,but cannot figure out where look at the log. just confirmat that admin interface and mysql row show nextblog.approachai.com . but the NEXTBLOG nav link on home page only show blog.approachai.com .
Also i suspect the {{navigation}} hander issue, but cannot found where have issue.
Hey, is there a possibility you put the navigation item into the secondary nav rather than the main one? There’s two navigations in Ghost now
baul
February 23, 2020, 6:50am
11
No,only in the first navigations in the admin menu
I’ve tried your navigation code on a local install and it seems to work ok, even when adding a subdomain. Just to make sure, are you hitting save when you change the navigation?
baul
February 27, 2020, 1:35pm
13
Save.
you can see https://blog.approachai.com/ again,only the nextblog fail,other ok.
Seems like there is some sanitization going on behind it. Might be related with this.
// If the hostname is present in the url
if (urlPath.indexOf(hostname) > -1
// do no not apply, if there is a subdomain, or a mailto link
&& !urlPath.split(hostname)[0].match(/\.|mailto:/)
// do not apply, if there is a port after the hostname
&& urlPath.split(hostname)[1].substring(0, 1) !== ':') {
// make link relative to account for possible mismatch in http/https etc, force absolute
urlPath = urlPath.split(hostname)[1];
urlPath = this.urlJoin('/', urlPath);
absolute = true;
}
baul
February 28, 2020, 2:35am
16
@minimaluminium Dont understand this.
But i find the issue is related with the url format.
The url path must end with some path, not only / such as http://aaa/ , should be https://aaa/pathcomponent .
If a nav item url contains hostname (blog.approachai.com in this case, because nextblog.approachai.com contains it), it trims next. So it looks like you should make your next blog’s url something like blognext.approachai.com. It works because it doesn’t contain the hostname blog.approachai.com.
baul
February 28, 2020, 6:00am
18
Yes,I should try it .
Note: chang nextblog.approachai.com to https://nextblog.approachai.com/androidstudiotips,first visit ok, But a few hours later ,it link change to https://blog.approachai.com/androidstudiotips by the running ghost , 404 error.