How to set up static sites with self hosted ghost on VPS - javascript

I just installed a ghost production environment on ubuntu 20.04 VPS with 1GB ram. I have also set up a dev environment locally on my mac where ill try out all my experiments.
My prod ghost installation is currently configured to the subdomain. ie.
blog.mydomain.com
I want to use ghost for managing most of my website, except for a few pages like the home page and my projects page, where I'd like to set up custom static sites with next.js or gatsby.
Is there any way to configure ghost to a subfolder within my root - and run
mycompany.com/blog
and use ssgs for the home and projects page.
If this isn't possible, Is there some other way to achieve this.
Thank you soo much for the help!!😀

Have you take a look at path prefixing? Adding the following in your gatsby-config.js should change your (sub)domain to /blog:
module.exports = {
pathPrefix: `/blog`,
}
Be aware that adding a pathPrefix you will force you to tweak your build and serve commands by adding the --prefix-paths flag

Related

Building svelte app as a set of static files

I want to use Svelte in my next project, due to its clean syntax and how nice is to work in it. Unfortunately, to deploy the app in my company I can't use node or anything like that on the server. I can only serve the app from nginx as static files.
Is it possible in svelte? I can't find anything that would allow me to do that, all solutions I've tried like #sveltejs/adapter-static didn't seem to generate it correctly to use it in this way. I can't find any guide on how to do that on the web.
In order to pre-render a SvelteKit 1.0 static site you need to:
Add to devDependencies in package.json (you can remove the default adapter-auto):
"#sveltejs/adapter-static": "next",
Run npm install
Add the following line to src/routes/+layout.js - create the file if it does not exist:
export const prerender = true;
Run npm run build
The static files will be generated in the build directory.
More details at https://github.com/sveltejs/kit/tree/master/packages/adapter-static#sveltejsadapter-static
If you aren't using SvelteKit, you can just copy contents of /build/ generated by npm run build. This should work.
I think Libertas' answer posted a couple of weeks after this is most likely what you're looking for.
But I'll leave the below here anyway in case it's useful to you or someone else coming along later:
SvelteKit (from the Svelte core team) supports server-side rendering, and documents generating static sites:
Static Sites
Most adapters will generate static HTML for any prerenderable pages of your site. In some cases, your entire app might be prerenderable, in which case you can use #sveltejs/adapter-static#next to generate static HTML for all your pages. A fully static site can be hosted on a wide variety of platforms, including static hosts like GitHub Pages.
(my emphasis)

Vercel - Deployment without promotion

Is there a way to create a deployment of my Nextjs app to production but without promoting it immediately to prod? Similar to a preview URL, but without public traffic being routed to that URL.
My use case is that I want to deploy a "pre-prod" app, run E2E tests there, and if they are successful, promote the app to production.
Is this flow possible?
I've used vercel --prod, but that just deploys the current version to production.
I want to create a production build that allows me to then use the alias command to point the traffic to a specific version.
Thanks in advance!
In this case, my opinion, you need to create an "intermediate" solution.
In vercel, you have "dev" "preview" and "production" environments (go to Settings-environment variables). You set some settings to preview env, it's ok for you, you can after "promote to production" your preview version.
Also, you can set up a special branch in git to directly deployment on preview

Hosting a bundle of scripts inside of NuxtJS

I'm a Systems Admin with limited-to-moderate programming experience. I got roped into creating a front-end app for work using Nuxt and Apache (Apache and SSR is a requirement). One of the other requirements in that I need to host this folder of JS scripts at /login. The scripts have nothing to do with Nuxt itself. I just need to host them as static assets for Apache to work with.
I've tried putting the folder within the static directory, but that didn't do anything. I've also tried messing around with webpack and vue-loader to no avail. Right now I have a temporary fix where I have Apache serving the login folder along with a redirect to the NodeJS server. However, I feel like this is messy.
Has anyone else dealt with this?

How to deploy ng2 app after ng-build

I've never understood what comes after the ng build command. I mean, how can you actually load your built app on a normal server and access it? Until now I've found only topics talking about the ng serve and ng build, saying that after the ng build you're done. But that's not true.
If I try to build and then navigate to the folder, I get a lot of errors in the console about files not found etc... not to mention errors about unmatched routes and so on.
The fact is that the app before the build using ng serve works like a charm, but I can't go to the client and say:
"Well, you have to use ng serve".
Jokes apart, how do I actually serve my built app without using GitHub pages and other hosts, but using my own server?
I swear that I've searched a lot on this topic, but I've never found a "stable" solution for it.
Thanks for any possible tip. I'm freaking out with this thing.
Because of new <base href="/"> attribute in the html, app is looking for your assets in the respective root folder.
So try to remove and run so that it will work and load the base href in run time.
You can use the below code to get it working
import {APP_BASE_HREF} from '#angular/common';
{provide: APP_BASE_HREF, useValue : '/' }
or using javascript
document.write('<base href="' + document.location + '" />');
If you use Angular CLI: ng build
Navigate to your app folder /dist
If you want to run it on your PC with no hassle just download USB Webserver and just copy the files to the root folder and run the server, you can port it to your client via usb or on client PC.
To run the app on a server: copy everything from dist folder + all your assets ( bootstrap.css or image folder or fonts folder)
http://162.244.83.64/
===========================================
If you are trying to run the app from local PC keep in mind that the app is looking for your assets in the root folder (C:/, D:/).
Open your Index.html file and edit the to point to the correct path, you don't need to do this on a server or hosting.

What HTML files should be edited in cordova?

I have seen a few references to this topic, but it's not 100% clear to me.
Inside the top level of a cordova project you have these folders '.cordova', 'merges', 'platforms', 'plugins', 'www'. I would think you edit the top level 'www' folder and it would update the files inside platforms\<platform>\assets\www because editing files directly in this path get overwrote, from what I have read and I experienced this once before deploying an app.
I can't find documentation on this (searching cordova update project just covers updating cordova itself, at least from what I am seeing maybe I'm being blind here).
How do the files in the root 'www' update the project files? I am sure there is a command for this but is it true I have to run an update command every time I make an edit in say Dreamweaver, because when I make an update it obviously doesnt make changes into the directory because it doesnt have anything telling it to.
So what I am asking.
You should edit the html/css/javascript inside the cordova projects root 'www'?
What are some solutions to updating the platform code from the main files?
Edit the content of www folder in main project directory and run cordova build command to copy these files to your platform specific directories. So the process will be like
Edit the content of www folder in project directory.
Debug the changes with any browser or emulator like Ripple.
Run cordova build command to test it in Android emulator or in a real device.
To use cordova command line tools, you need to install cordova command line interface. It can be found here.

Categories