Once you can build a static site, the next step is building one that stays fast, secure and easy to change as it grows. This guide covers the advanced practices that matter in 2026: modern build tools, current CSS and JavaScript features, Core Web Vitals, structured data, security headers and automated deployment.
Use a modern generator or build tool (Astro, Eleventy, Hugo or Vite) and ship as little JavaScript as possible. Lean on current CSS (container queries, :has(), nesting, view transitions) instead of scripts. Measure Core Web Vitals, including INP, and fix the largest image first. Add structured data and security headers, keep secrets out of the browser, and automate the build and upload with CI. On shared hosting, publish the built folder to public_html over FTP with TLS.
1. The modern static stack
Most serious static sites are pre-rendered: a build step turns components, templates and content into plain files.
| Tool | Best for | Output folder |
|---|---|---|
| Astro | Content sites with occasional interactive "islands" | dist |
| Eleventy | Simple, template-driven sites and blogs | _site |
| Hugo | Very large sites that must build quickly | public |
| Vite (plain) | Hand-built multi-page sites with a fast dev server | dist |
| Next.js, Nuxt, SvelteKit | Apps already written in those frameworks, exported as static files | out, .output/public, build |
For frameworks, check that static export is actually enabled. Next.js needs output: 'export' in next.config.js, and any feature that needs a server, such as API routes or on-demand rendering, will not work in a static export. See Next.js hosting in 2026 for the trade-offs.
2. A developer workflow that scales
- Pin your tools. Commit
package-lock.json, add.nvmrcwith your Node.js LTS major version, and build withnpm ciin CI. - Preview fast. Dev servers from Vite, Astro and Eleventy reload the page as you save.
- Format and lint automatically with Prettier, ESLint and Stylelint in a pre-commit hook.
- Check links in the built output during the build, so a renamed page never ships a broken link.
3. Modern CSS instead of JavaScript
Many effects that once needed JavaScript are now plain CSS, supported in all current browsers:
/* A card that changes layout based on its own width, not the screen */
.card-list { container-type: inline-size; }
@container (min-width: 36rem) {
.card { display: grid; grid-template-columns: 12rem 1fr; gap: 1rem; }
}
/* Style a form group that contains an invalid field */
.field:has(input:user-invalid) { border-color: var(--error); }
/* Fluid type without media queries */
h1 { font-size: clamp(1.8rem, 1.2rem + 2.5vw, 3rem); }
/* Smooth page-to-page transitions on a multi-page site */
@view-transition { navigation: auto; }
/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation: none !important; transition: none !important; }
}Browsers without view-transition support simply change pages normally, so nothing breaks.
4. JavaScript: less, later, and modular
- Ship JavaScript only where there is interaction. Astro's islands, or a small ES module per feature, beat a single large bundle.
- Use native modules: a script tag with
type="module"is deferred by default and needs no bundler for small sites. - Progressive enhancement: the menu, form and gallery should work, or at least degrade clearly, without JavaScript.
- Pin third-party scripts with Subresource Integrity (
integrity="sha384-…") or, better, self-host them.
5. Core Web Vitals and performance budgets
Google's Core Web Vitals are LCP (loading), INP (responsiveness, which replaced FID in 2024) and CLS (visual stability). Static sites have a head start, but images and third-party scripts can undo it.
- Fix the LCP element first, usually the hero image: serve AVIF or WebP through
pictureandsrcset, addfetchpriority="high", and never lazy-load it. - Prevent layout shift: set
widthandheight(oraspect-ratio) on every image, video and embed, and reserve space for banners. - Keep INP low: avoid long JavaScript tasks. Chat widgets, heavy analytics and tag managers are the usual culprits.
- Set a budget, for example under 200 KB of JavaScript per page, and fail the build when it is exceeded, using Lighthouse CI or a bundle-size check.
6. SEO, structured data and multiple languages
- Structured data: add JSON-LD for your organisation, articles, products, FAQs or breadcrumbs, and validate it with Google's Rich Results Test.
- Canonical URLs and a sitemap: most generators can create
sitemap.xmlfor you; list it inrobots.txt. - Social previews: Open Graph tags (
og:title,og:image) control how links look when shared. - Multiple languages: publish each language at its own URL (
/en/,/hi/) and connect them withhreflanglinks. Hugo and Astro have built-in internationalisation support. Machine translation is a starting point; have a person review key pages. - Skip AMP. Google no longer requires AMP for Top Stories, and a fast static page already meets the same goals.
7. Dynamic features without your own back end
- Search: Pagefind builds a search index at build time and runs entirely in the browser.
- Forms: on shared hosting, a small server-side script (such as PHP) can validate the input and email it to you; alternatively, use a form service. See PHP sendmail settings.
- Content editing: a headless or Git-based CMS lets editors change content that the generator pulls in at build time.
- Analytics: choose a privacy-friendly, cookieless tool where you can, and load it with
defer. - Secrets stay on a server. Any API key in front-end JavaScript is public. If a feature needs a secret, it needs a server-side piece.
8. Security for static sites
With no server code, the attack surface is small but not zero:
- Serve only over HTTPS. Free SSL is included with Domain India hosting.
- Don't publish what you didn't mean to: check that the upload never includes
.git,.env, source files or backups. - Send security headers. On Apache hosting you can set them in
.htaccess. Wrap them inIfModuleso the site keeps working if a module is unavailable, and test a Content Security Policy in report-only mode first:
<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
Header always set Content-Security-Policy-Report-Only "default-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'"
</IfModule>- Audit dependencies with
npm auditbefore each release; build tools have vulnerabilities too.
9. Automated deployment with CI
A CI pipeline builds the site on every push to your main branch and uploads the output. For shared hosting, the upload is FTP over TLS; with lftp it is one command:
lftp -u "$FTP_USER","$FTP_PASSWORD" "$FTP_HOST" -e "
set ftp:ssl-force true; set ssl:verify-certificate true;
mirror --reverse --only-newer --verbose dist/ public_html/;
quit"Store the host, username and password as CI secrets, never in the repository, and use an FTP account limited to the site's folder. Adding --delete also removes server files that are not in your build, including anything else in that folder, so exclude folders such as .well-known if you use it. For a ready-made GitHub Actions workflow, see Deploying to cPanel from GitHub Actions.
10. Running a modern static site on Domain India
Shared hosting is the natural home. Build on your computer or in CI, then upload the output folder's contents to public_html with the File Manager, FTP or a CI job. .htaccess works on cPanel, DirectAdmin and Webuzo. On our cPanel servers, FTP over TLS on port 21 presents a valid certificate; use the server hostname from your welcome email so the name matches. On cPanel a page can be served from cache for up to 120 minutes, so add ?t=1 to a URL to confirm a deploy.
App Platform is built for applications, not plain files. It detects Node.js apps automatically and runs anything else from a Dockerfile, so it suits a static site only if you want a container. The container must listen on the PORT variable and bind to 0.0.0.0. With the official nginx image, a template file is filled in with PORT at start-up:
FROM node:24-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:stable-alpine
COPY default.conf.template /etc/nginx/templates/default.conf.template
COPY --from=build /app/dist /usr/share/nginx/html# default.conf.template
server {
listen ${PORT};
root /usr/share/nginx/html;
location / { try_files $uri $uri/ =404; }
}Deploy it with Deploy Now from GitHub or with a deploy token; see Getting started with the App Platform.
- 50 GB NVMe SSD Storage
- 100 GB Monthly Bandwidth
- 5 Websites
- 50 Email Accounts
- 512 MB RAM per app
- 1 vCPU
- 5 GB NVMe SSD
- PostgreSQL Database
Which static site generator should I use in 2026?
Astro for content sites that need a little interactivity, Eleventy for simple template-driven sites, and Hugo for very large sites that must build quickly. All produce plain files you can upload anywhere.
What replaced FID in Core Web Vitals?
Interaction to Next Paint (INP) replaced First Input Delay in March 2024. It measures how quickly the page responds to clicks, taps and key presses throughout a visit.
Do I still need AMP for a fast mobile site?
No. Google no longer requires AMP for Top Stories, and a well-built static page is already fast on mobile.
How do I add security headers to a static site on shared hosting?
Add Header directives in an .htaccess file inside an IfModule mod_headers block, and test a Content Security Policy in report-only mode before enforcing it.
Can I deploy a static site automatically from GitHub to shared hosting?
Yes. A CI job can build the site and upload the output over FTP with TLS. Keep the FTP details in CI secrets and use an FTP account limited to the site's folder.
Can I host a static site on the Domain India App Platform?
You can, by running it from a Dockerfile, for example with nginx listening on the PORT variable. For most static sites, shared hosting is simpler.
Ready to launch? Choose cPanel hosting for your built site, look at the App Platform for containers, or ask us in a support ticket which fits your project.
Upload your build with FTP over TLS or the File Manager, with free SSL included.
See hosting plans