About Us Page Content Generator

About Us Page Content Generator

Craft a compelling company story that connects with your audience.

Company Information

Generated "About Us" Content

Your AI-generated "About Us" page content will appear here.

AI is crafting your story...

`; const systemPrompt = "You are a professional brand strategist and copywriter. Your task is to write an 'About Us' page for a company. Use the provided details to create three distinct sections: 'Our Story', 'Our Mission', and 'What We Do'. Ensure the tone is consistent with the user's request. Respond only with a valid JSON object matching the provided schema."; const userPrompt = `Company Name: "${inputsData.name}", Industry: "${inputsData.industry}", Company Story: "${inputsData.story}", Tone of Voice: "${inputsData.tone}"`; const jsonSchema = { type: "OBJECT", properties: { our_story: { type: "STRING" }, our_mission: { type: "STRING" }, what_we_do: { type: "STRING" } }, required: ["our_story", "our_mission", "what_we_do"] }; const apiKey = ""; const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-05-20:generateContent?key=${apiKey}`; const payload = { contents: [{ parts: [{ text: userPrompt }] }], systemInstruction: { parts: [{ text: systemPrompt }] }, generationConfig: { responseMimeType: "application/json", responseSchema: jsonSchema } }; try { const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); if (!response.ok) throw new Error(`API Error: ${response.statusText}`); const result = await response.json(); const aiResult = JSON.parse(result.candidates?.[0]?.content?.parts?.[0]?.text); if (aiResult.our_story && aiResult.our_mission && aiResult.what_we_do) { generatedContent = aiResult; renderContent(); } else { throw new Error("The generated content was incomplete."); } } catch (error) { console.error("Content generation error:", error); resultsContainer.innerHTML = `

An error occurred: ${error.message}

`; showNotification("Error generating content."); } finally { generateBtn.disabled = false; generateBtn.textContent = 'Generate Content'; } } function renderContent() { if (!generatedContent) return; resultsContainer.innerHTML = `

Our Story

${generatedContent.our_story}

Our Mission

${generatedContent.our_mission}

What We Do

${generatedContent.what_we_do}

`; } // --- UTILITY FUNCTIONS --- function showNotification(message) { notification.textContent = message; notification.classList.remove('opacity-0'); setTimeout(() => notification.classList.add('opacity-0'), 2000); } function copyToClipboard(text, message) { navigator.clipboard.writeText(text).then(() => showNotification(message)); } copyBtn.addEventListener('click', () => { if (!generatedContent) { showNotification("Nothing to copy."); return; } const textToCopy = `Our Story\n${generatedContent.our_story}\n\nOur Mission\n${generatedContent.our_mission}\n\nWhat We Do\n${generatedContent.what_we_do}`; copyToClipboard(textToCopy, 'Content copied!'); }); // --- PDF GENERATION --- async function generatePdfReport() { if (!generatedContent) { showNotification("No content to export."); return; } downloadPdfBtn.disabled = true; downloadPdfBtn.textContent = '...'; const reportHtml = `

About Us: Company Story & Brand Narrative

For: ${inputsData.name}

Our Story

${generatedContent.our_story}

Our Mission

${generatedContent.our_mission}

What We Do

${generatedContent.what_we_do}

`; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-page'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(), pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save(`About_Us_${inputsData.name.replace(/\s+/g, '_')}.pdf`); } catch (e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download PDF'; pdfTemplate.classList.add('invisible'); pdfTemplate.innerHTML = ''; } } // --- EVENT LISTENERS --- generateBtn.addEventListener('click', generateContent); downloadPdfBtn.addEventListener('click', generatePdfReport); });
Scroll to Top