Skip to content

Edit New Site

Editing or replacing the default web site

If a server account has just been setup then an email will have been sent to you with important details.

If you are the admin for a server account then you can set up additional sites yourself, using link provided in email and with guides to be provided.

The default web site has a simple first page with three forms to allow users to contact you, to subscribe to a newsletter and to unsubscribe from a newsletter.

This is achieved by overriding Virtualmin default behaviour. All overrides are currently in English, unlike with Virtualmin.

The site template (using Astro) is deliberately kept simple to allow you to adapt it directly, if you wish.

Also it will help if you want to know what to do to adapt this approach with any other Astro template instead.

The module source code is useful for adaptation for use with any other approach.

Downloading and installing source template for site editing

The template source code for the site is an Astro Starter Template, hosted on github that can be downloaded and installed with a single command.

npm create astro@latest -- --template hostfurl/name-to-be-provided

Full Link to be provided

An examination of the source code shows the forms are very easily generated using a public hostfurl npm module. Link to be provided.

Other than adding in the tailwind integration (which is done for you in the template), there is an addition to tailwind.config.mjs (done for you), a very short file in ./src/components/EmailForms.astro (added in for you), a small amount of editing with tailwind in index.astro and the following lines added to index.astro (all done for you)

import EmailForms from "../components/EmailForms.astro"
const PUBLIC_TITLE = import.meta.env.PUBLIC_TITLE ?? "PLACEHOLDER_PUBLIC_TITLE"

and

<EmailForms />

The forms use tailwind and the tailwind classes can be easily edited within the hostfurl module collectively in a single file for merging. They can also be overridden.

If you continue to use hostfurl module as is, then the tailwind classes merge file will need to be backed up as it will get overridden with updates.

Add and edit .env files

The template is easier to use with a .env for the title:

PUBLIC_TITLE="Web Site Title"

To use cross origin for development, add in a .env.development file

PUBLIC_MAILFORMAPI="https://example.com/cgi-bin/mailform.cgi"

with the correct details for PUBLIC_MAILFORMAPI, as notified.

To use cross origin for a production site (such as with CDN), add in a .env.production file. Not necessary when updating website on original server as not cross origin.

PUBLIC_MAILFORMAPI="https://example.com/cgi-bin/mailform.cgi"

with the correct details for PUBLIC_MAILFORMAPI, as notified.

If you prefer you can just use a single .env file and add in PUBLIC_MAILFORMAPI line there.

Forcing refresh with .env file changes

It should not be necessary to change to the .env file once set. If you do make changes and they do not appear to work, force a browser refresh with Ctrl+Shift+R.

Uploading Changes

Details to be provided