-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Ghost install in sub directory support #527
Comments
This is the very first thing I tried to do. I have a portfolio, and the blog is just a subpath I want Ghost to live their so all of my content falls under one domain and I already have a website that I don't want to hack into a bunch of posts inside of Ghost. |
@fform In the meantime you could consider putting your blog on a subdomain a la |
Is this issue really about config.production.url? Or is it just outdated? I'm running Ghost behind a reverse proxy so this is absolutely necessary... |
It's out of date - we were trying to keep URLs out of Ghost for as long as possible to prevent the WP problem where they creep into places they're not needed. I've updated the issue. |
+1 for this feature. Didn't realise it didn't support it until I got into a pickle with it. Starting on a subdomain for now, but want to migrate asap. |
+1 for this as well. My predicament is my wordpress permalinks are %category%/%postname%, but basically everything as in the "blog" category. While plugin support would let me do some 301s and be just fine, this feature would let me just install Ghost at /blog, pop a landing page up at /, and be set. |
We really want to roll this feature in 0.4, just needs someone to pick it up ;) |
Dibs - I'll work on it. |
Nice one, thanks @halfdan. I'd love to get involved but been stacked-out lately. |
@tgriesser - this seems much more of a contribution towards #1326 ? This snippet doesn't cover how to make Ghost itself respect subdirectories, which is what this issue is about and should be relatively straight forward with express mounting. I really want to get #1326 and other refactoring things done - but they never seem to get past first base. |
I think I have this working. Temporary live demo site at https://risacher.org/ghost-blog/ Unfortunately it's a moderately invasive change since it involves every URI generated by Ghost or Casper, and even required a change to connect-slashes |
Heh, subtle irony here... Shortly after getting it working, I started rebaselining on the current HEAD, since my fork was about 3 days behind. In doing so, I broke the working install when I moved it out of the way. The ironic bit: since the feature I'm working on allows multiple simultaneous instances, there was no reason to move it out of the way. |
…everse proxy addresses TryGhost#527 - useful when running behind a reverse proxy - for consideration/discussion only. I actually don't advocate this - instead of having a base_url string to prepend to URIs, a more flexible approach would be a local_url() mapping function - since it is targeted at node-http-proxy, it fixes generated URIs but does not change the routes listened for. - there is a corresponding pull request for Casper - there is a corresponding pull request for connect-slashes fix {{url}} helper
This work is not done, but anyone who wants to see what I've got so far can look at: https://github.com/risacher/Ghost/compare/base_path The basics seem to work, but image uploading (and sometimes downloading) are still broken. On reflection, I don't like my own approach that much. A function to transform the URIs would be much more general than adding in a string. I'm thinking about starting over with that approach. |
@risacher Interesting approach, but not what it should look like. I'm working on a PR, so you might just wait for that. |
+1 on the feature, extremely important for seo reasons (to have your blog content on the main domain) |
Got three questions regarding the implementation (@ErisDS):
|
Q1: I don't think so, in themes we'll want the path for making relative URLs and the url+path for making absolutes, but rarely if ever need the stripped URL? That's my logic anyway @hswolff might be worth you glancing over this stuff & adding your own 2c because it's quite relevant to what you are working on |
Q1: I'm not clear what you mean here. If the url from the config files is Q2: Just a nit, maybe call res.locals.rootPath res.locals.ghostRoot as that may be clearer? Up to you, just a nit-pick. 🍡 |
@ErisDS: Do you see an easy way of prepending the subdir to everything before https://github.com/TryGhost/Ghost/blob/master/core/server.js#L226? Basically all the shared/ and built/ stuff. |
I wasn't sure if I should make a separate issue, but I figure it might be relavant enough not to. After commit e210e75, I tried putting ghost in a subdirectory ("+"), and got this exception (doing a clean initial setup of Ghost):
Going to It looks like there's still a bit more work to do with this. If I'm reporting this prematurely and it is known that commit e210e75 alone isn't enough (or if setting the url to contain the subdirectory in config.js is not the right way to test this feature), then just ignore this. |
@mjbshaw The feature isn't finished yet (that's why the issue is still open). Right now only the front end will work - the admin area should show a blank page and not fail as it does in your case. I'll look into this issue as I finish the implementation of this functionality. |
@halfdan any further progress on this / what's remaining? I can help out tomorrow afternoon to get this done. |
@miksago It's gonna be finished by then :) Thanks! |
@halfdan awesome! Looking forward to testing this out! |
@halfdan, what is left to do on this now? I did notice that the link to the password reset on the sign in screen does not respect the subdir. |
Oh, it's all done - I just haven't pushed the changes yet. Meant to wait for Travis build to pass before pushing. |
It's not perfect, but currently working much better than it was. |
I want to do a similar thing, except have the posts read at |
@jbrooksuk That's already in the code as well, the only thing missing is a proper UI to configure it (see #1631). |
Hey @halfdan I know you're totally snowed under and it's nearly the holidays, so could you please update me on where you are at, and push up your latest work? I'd like to help please! |
@halfdan ping ;) |
Soooo.. PR is in - I decided not to add a utils module since @hswolff refactored most of the paths nicely into config/paths.js. The new
vs.
I think the slightly shorter module version isn't enough to introduce a new module to ghost. |
fixes TryGhost#527 - Fix image upload in backend - Use config.paths().webroot where necessary
Is this implemented in 0.4? |
Release announcement: http://blog.ghost.org/ghost-0-4/ |
We want to support sub directories so that someone can feasibly install their Ghost at myurl.com/blog/.
{{url}}
theme helper (Theme API:{{url}}
handlebars helper #528), and probably most of the internal paths.The text was updated successfully, but these errors were encountered: