Home page stories are not visible


#1

Hi,
While running my theme Sparta on localhost, we can see all the stories in the home page. However after deploying in production server. We are unable to see all our stories on


#2


#3

Can you maybe provide us with the source code you’re using to fetch the posts?


#4
{{#get "posts" filter="featured:true" include="tags,authors" order="published_at desc"}} 
            {{#foreach posts}} 
                {{!-- The tag below includes the markup for each post - partials/post-card.hbs --}} 
                {{> "post-card"}} 
            {{/foreach}} 
        {{/get}}
        
        {{#get "posts" filter="featured:false" include="tags,authors" order="published_at desc"}}
            {{#foreach posts}} 
                {{!-- The tag below includes the markup for each post - partials/post-card.hbs --}} 
                {{> "post-card"}}
            {{/foreach}}
        {{/get}}

#5

Hmm, seems weird to me. The code is correct. Which ghost version are you using locally? Are you using the same version and same settings on the server?


#6

local : 2.11.1 same in prod server.

is there any other scenario in which this issue might happen ?


#7

Have you tested the theme on a third Ghost installation? That could lock the issue down to either the theme or your server.

If you don’t have a third Ghost install, I could test it for you on my install if you feel comfortable with that, but of course that’s up to you.


#8

Are You Added The Code In package.json File ?

    "engines": {
        "ghost": ">=2.0.0",
        "ghost-api": "v2"
    },

follow the default casper theme’s package.json .


#9

currently,

“engines”: {
“ghost”: “>=1.2.0”
}

i am going to change now to what you suggested.


#10

Have Any Console Error As Like As “get” ghost api not fount


#11

The theme should work just fine without the JSON code you provided. My theme doesn’t have that code segment included either, but the posts still show up for me. Either it’s a weird theme error, or @dev_xp has a faulty installation on his server.


#12

You’re using the {{#get}} helper, which requires access to the API.

The API version is configured via your theme’s package.json:

"engines": {
   "ghost-api": "v2"
},

For backwards compatibility, when this is not specified, the API version falls back to v0.1. However, this API is now deprecated, and is disabled by default on new installs.

I guess that locally you have an install with the v0.1 enabled (you’d see this in the Labs screen) and in production the v0.1 API is disabled.

Upgrading your theme to use the v2 API is the way forward.


#13

Ty it worked after mentioning version in package.json


closed #14

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.