Hosting the files from folder directly

How to host the some custom hbs file that is in my VPS? Like I have my /ghost/themes/casper directory hosted and now I want to manually add file and same hosted from this path also /ghost/themes/casper/releases/1100.hbs so my website should show website.com/releases/1100

It’s not entirely clear what you are trying to achieve. However, to modify a theme, including the .hbs files, you should edit the theme to customize as needed, then zip up the whole theme folder, and upload to Ghost.

I will try to be more clear. If this is my current structure

β”œβ”€β”€ /assets
|   └── /css
|       β”œβ”€β”€ screen.css
|   β”œβ”€β”€ /fonts
|   β”œβ”€β”€ /images
|   β”œβ”€β”€ /js
β”œβ”€β”€ default.hbs
β”œβ”€β”€ index.hbs
└── post.hbs
└── package.json

I want to make it like this

β”œβ”€β”€ /assets
|   └── /css
|       β”œβ”€β”€ screen.css
|   β”œβ”€β”€ /fonts
|   β”œβ”€β”€ /images
|   β”œβ”€β”€ /js
β”œβ”€β”€ /releases
|   └── /1100.hbs
|   └── /1101.hbs
|   └── /goeson.hbs
β”œβ”€β”€ default.hbs
β”œβ”€β”€ index.hbs
└── post.hbs
└── package.json

So my the page URL will become website.com/releases/1100, website.com/releases/1100 and goes on… But I am not sure how to make it work.

I still don’t understand what you’re trying to achieve since these folders are neither served nor accessible via a web browser.

Perhaps it would help if you explained the objective.

Like I want to serve my custom HTML code to my website in a folder inside the ghost hosting directory because I want the URL format to be like this website.com/releases/1100 so I have some certain webpages that will appear under the directory called as releases. Basically I am trying to get the proper URL for some of webpages.
Once again, I am trying to get this custom link format for my webpages under releases.

Custom HTML etc. is determined by the default theme. Therefore, make changes to the theme files, and let Ghost handle locations. More than one theme may be uploaded, so switching between themes is simple.

Your theme doesn’t really interact with URL formatting in Ghost; that’s primarily handled by Dynamic Routing.

If you need custom HTML for your releases page, you probably want to use custom post templates and/or an HTML card.

1 Like

Got it. Can you just help with giving an idea of how I can possibly write dynamic routing code for my situation?

I haven’t tested it, but something like this. You’ll need to tag all your release posts with #release, and the slug should be the number (e.g. 1100)

routes:

collections:
  /:
    permalink: /{slug}/
    template: index
    filter: -tag:hash-release
  /releases/:
    permalink: /releases/{slug}/
    filter: tag:hash-release

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/
1 Like

Okay, I understood the format and went through the documentation also. But when I tried it only works with using posts because of which it is visible under an author. Our website wants no extra featuring like comments and visible under the author apart from the custom URL.
I can give the logic of our case, the URL - releases is based on pages for our team’s every month’s stats and updates and obviously it should not appear under any author nor have comments section for it. Like website.com/releases/0001 and goes on till around website.com/releases/0350
I would be thankful if you could guide with the format for custom link for pages option.

I’m not entirely sure if you can prevent the post from appearing in the author list without messing up the post count. As a workaround, it is possible to create a new user (e.g. release-bot) and attribute all the release posts to that author - it might not fix the author issue, but it would prevent other authors’ page from getting messed up.

Regarding formatting - you can either update your existing post template to conditionally hide elements when rendering a release post, or you can use a custom post template.

Here’s an example:

{{^has tag="hash-release"}}
 {{comments}}
{{/has}}

This translates to β€œUnless the current item has the tag #release, load the comments”

Thank you, I will try it out.