Article Generator Blog–A Complete Single-Page Blogger Website
Introduction
Create a fully functional Blogger-style single-page website using only HTML, CSS, and JavaScript. This page allows users to generate articles instantly based on keywords, word count, language, and tone.
Website Structure
1. Header Section
- Gradient background (
#2c3e50to#3498db). - White text, centered title: "Article Generator Blog".
- Tagline: "Create unique articles instantly for your blog!"
2. Main Content Container
- Max-width: 900px, centered on the page.
- Styling: White background, subtle box-shadow, and rounded corners.
- Contains two sections:
- Article Generator Form (
h2title: "Generate Your Article") - Output Display (
h2title: "Your Generated Article") – styled like a blog post.
- Article Generator Form (
Article Generator Form
Form Fields:
- Keywords: Text input (required) – placeholder:
"e.g., Urdu poetry, nature". - Word Count: Dropdown selection – options:
100, 200, 300, 500, 750, 1000 words. - Language: Dropdown –
English, Urdu, Bilingual (Urdu & English). - Tone: Dropdown –
Formal, Casual, Creative.
Buttons:
- Generate Article:
Blue (#3498db)– Submit button. - Clear:
Red (#e74c3c)– Resets form and output.
Generated Article Display
- The article is displayed inside a
<p>withid="articleText". - Word count is shown in
<p>withid="wordCountDisplay"(e.g.,"Word Count: 300"). - Download Button:
Green (#27ae60), disabled by default, enabled when an article is generated. - Styling: Left border
#3498db, padding, subtle shadow.
Styling (CSS)
- Body: Light gray background
#f5f5f5. - Header:
- Gradient background, 20px padding, centered text.
- Container:
- White background, 30px auto margin, 20px padding, 8px border-radius, box-shadow.
- Form Section:
- Flex column layout, 15px gap, light gray background
#f9f9f9, 15px padding.
- Flex column layout, 15px gap, light gray background
- Buttons:
- 10px padding, rounded corners, hover effects (darker shades).
- Output Styling:
- 20px padding, 5px left border, subtle shadow.
- Urdu Text:
- Right-to-left direction,
Jameel Noori Nastaleeqfont (Google Fonts), 1.3em font size.
- Right-to-left direction,
- Default Font:
Arial, sans-serif.
JavaScript Functionality
On Form Submission:
- Prevent default form submission.
- Fetch values (
keywords,wordCount,language,tone). - Generate an article using static templates (no external APIs).
- Display the article inside
"articleText". - Update
"wordCountDisplay"with actual word count. - Enable
"Download Article"button, allowing users to save the article as a.txtfile (filename based on keywords). - Apply
"urdu-text"class if Urdu or Bilingual mode is selected.
On "Clear" Button Click:
- Reset the form.
- Set
"articleText"to default text ("Enter keywords above to generate your article..."). - Remove
"urdu-text"class. - Reset word count to
0. - Disable the
"Download Article"button.
Static Templates for Article Generation
- Uses predefined chunks of text (e.g., 25-word blocks).
- Includes connectors like
"Moreover,"and"مزید برآں،"for natural flow. - Avoids excessive keyword repetition.
- Example (English Creative Tone):
"${keyword} dances like a whisper in the wind, unfolding stories...".
Additional Requirements
- Include
<link>for Google Fonts (Jameel Noori Nastaleeq) in<head>. - Ensure the code runs entirely in a browser (no external files/APIs).
- Save the file as
index.htmland test in a browser.
Complete Code Implementation
The full HTML, CSS, and JavaScript code is provided in a single-file format (index.html). This ensures the website runs smoothly without needing additional files.
Comments
Post a Comment