This project is a fully functional, production-ready static website featuring over 250 reversible unit converters. It is built with HTML, TailwindCSS, and vanilla JavaScript, and is optimized for SEO, AdSense, and fast loading speeds.
- 270+ Reversible Converters: A comprehensive collection of unit converters across various categories.
- Static Site: No backend, no database. Works perfectly on any static hosting provider.
- Automated Page Generation: Individual, SEO-friendly pages for each converter are generated by a script.
- Search and Filter: Easily find any converter from the homepage.
- Dark Mode: User-toggleable dark mode for comfortable viewing.
- SEO Optimized: Auto-generated meta titles, descriptions,
sitemap.xml, androbots.txt. - Monetization Ready: Placeholders for Google AdSense and Google Analytics 4 are integrated.
- Blog System: A simple, expandable blog system.
- HTML
- TailwindCSS (via CDN)
- Vanilla JavaScript
.
├── assets/
│ ├── css/
│ │ └── style.css # Custom CSS
│ └── js/
│ ├── conversions.js # Core converter data and formulas
│ └── main.js # Homepage logic (search, filter, etc.)
├── blog/
│ ├── index.html # Blog listing page
│ └── ... (post files)
├── converters/
│ └── ... (270+ generated converter pages)
├── about.html
├── contact.html
├── index.html # Homepage
├── privacy.html
├── terms.html
├── converter-template.html # Template for generating converter pages
├── generate_pages.sh # Script to generate converter pages
├── sitemap.xml
└── robots.txt
The entire converter system is managed from a single file.
- Open
assets/js/conversions.js: This file contains the array of all converter objects. - Add or Edit an Entry: To add a new converter, add a new object to the
convertersarray. To edit, modify an existing one. The format is:{ category: "Category Name", from: "Unit A", to: "Unit B", formula: (x) => /* formula to convert A to B */, reverse: (x) => /* formula to convert B to A */ }
- Important: After adding or modifying converters in
conversions.js, you must re-run the page generation script to create or update the individual converter pages.
A bash script is provided to automatically generate all the individual converter pages based on the data in conversions.js and the converter-template.html.
- Make sure you are in a Bash environment (like Linux, macOS, or WSL on Windows).
- Run the script:
Note: The script in this repository is configured to run in batches to avoid overwhelming some systems. You may need to run it multiple times with different ranges if you add a very large number of new converters.
bash generate_pages.sh
This is a standard static website. You can deploy it to any static hosting provider. Here are instructions for popular services:
These platforms offer seamless deployment by connecting directly to your Git repository.
- Connect your Git repository: Connect your GitHub, GitLab, or Bitbucket account where this project is hosted.
- Configure the build settings:
- Build Command: Leave this empty. There is no build step required.
- Output Directory / Publish Directory: Set this to the root of the project (
/or leave empty, as all files are in the root).
- Deploy: That's it! The platform will serve the static files.
For hosting providers that use a file manager like Hostinger, the process involves uploading the files manually.
- Prepare the files: Make sure all files for the website are in a single folder on your computer.
- Compress the files: Create a
.ziparchive of the entire project folder. - Log in to your hosting panel: Access your Hostinger hPanel or cPanel.
- Open the File Manager: Navigate to the File Manager tool.
- Go to
public_html: This is the root directory for your website. - Upload the
.zipfile: Use the upload functionality in the File Manager. - Extract the archive: Once uploaded, right-click the
.zipfile and select "Extract". You can extract the files directly intopublic_html.
Your website will now be live.
- Google AdSense: Ad slots are included as placeholder
<div>elements in the HTML files (e.g.,id="adsense-header"). To enable ads, replace these placeholders with your AdSense ad code. - Google Analytics: The Google Analytics 4 placeholder script is included in the
<head>of all pages. To enable analytics, replaceG-XXXXXXXXXXwith your own Google Analytics Measurement ID.