Automotive Blog Post Generator

Automotive Blog Post Generator

Create engaging content for car enthusiasts and buyers.

This level of performance translates to exhilarating acceleration and a commanding presence on the road.

`, Interior: (topic) => `

The Cockpit: Comfort Meets Technology

Slide into the driver's seat of the ${topic}, and you're greeted by a modern, driver-focused cockpit. The interior features [e.g., premium leather-trimmed seats], a [e.g., 12.4" digital instrument cluster], and a large touchscreen infotainment system with the latest connectivity options. It's a perfect blend of aggressive styling and everyday usability.

`, Driving: (topic) => `

Behind the Wheel: The Driving Experience

Raw power is one thing, but how does the ${topic} handle? On the road, it feels [e.g., responsive and planted, with sharp steering and a configurable suspension]. Whether you're carving through winding back roads or cruising on the highway, the driving dynamics are engineered to inspire confidence and deliver pure enjoyment.

`, Verdict: (topic, audience) => `

The Verdict: Is the ${topic} Right for You?

After a thorough review, it's clear that the ${topic} is a formidable machine. For ${audience} looking for a combination of thrilling performance, modern technology, and iconic style, it's a very compelling package. While the price point of [e.g., around $45,000] places it in a competitive segment, its unique character helps it stand out from the crowd.

`, Maintenance: (topic) => `

Owner's Corner: Essential Maintenance Tips

To keep your ${topic} running in peak condition, regular maintenance is key. Here are a few tips:

  • Oil Changes: Follow the manufacturer's recommended interval, typically every 5,000-7,500 miles, using full synthetic oil.
  • Tire Care: Regularly check tire pressure and rotate them every 6,000 miles to ensure even wear.
  • Brake Inspection: Have your brake pads and rotors inspected annually, especially with performance driving.
` }; const generatePost = () => { const topic = topicInput.value.trim(); const audience = audienceInput.value.trim(); const selectedSections = Array.from(document.querySelectorAll('#sections-container input:checked')).map(cb => cb.value); if (!topic) { postContainer.innerHTML = '

Please enter a vehicle or topic for the post.

'; return; } let postHTML = `

Full Review: The ${topic}

`; selectedSections.forEach(key => { if (sectionTemplates[key]) { postHTML += sectionTemplates[key](topic, audience); } }); postContainer.innerHTML = postHTML; outputTitle.textContent = `Generated Post: ${topic}`; downloadPdfBtn.classList.remove('hidden'); }; const downloadPdf = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const content = getEl('generated-post-container'); const title = `Full Review: The ${topicInput.value.trim()}`; const pageWidth = doc.internal.pageSize.getWidth(); const margin = 15; // --- PDF Template: Automotive Review --- // Header doc.setFillColor(30, 64, 175); // Blue-800 doc.rect(0, 0, pageWidth, 28, 'F'); doc.setDrawColor(255, 255, 255); doc.setLineWidth(0.5); doc.line(margin, 22, pageWidth - margin, 22); doc.setFont('helvetica', 'bold'); doc.setFontSize(18); doc.setTextColor(255, 255, 255); doc.text("AUTO REVIEW", margin, 16); // Main Title doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(30, 58, 138); // Blue-900 const splitTitle = doc.splitTextToSize(title, pageWidth - (margin * 2)); let startY = 40; doc.text(splitTitle, margin, startY); startY += (splitTitle.length * 7) + 5; html2canvas(content, { scale: 2, useCORS: true, windowWidth: content.scrollWidth, windowHeight: content.scrollHeight }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const imgProps = doc.getImageProperties(imgData); const pdfWidth = pageWidth - (margin * 2); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; let heightLeft = pdfHeight; let position = startY; doc.addImage(imgData, 'PNG', margin, position, pdfWidth, pdfHeight, undefined, 'FAST'); heightLeft -= (doc.internal.pageSize.getHeight() - position - 15); while (heightLeft >= 0) { position = heightLeft - pdfHeight; doc.addPage(); doc.addImage(imgData, 'PNG', margin, 15, pdfWidth, pdfHeight, undefined, 'FAST'); heightLeft -= (doc.internal.pageSize.getHeight() - 15); } // Footer on all pages const pageCount = doc.internal.getNumberOfPages(); for(let i = 1; i <= pageCount; i++) { doc.setPage(i); doc.setFontSize(9); doc.setTextColor(100, 116, 139); doc.text( `Automotive Post | ${topicInput.value.trim()}`, margin, 285 ); doc.text( `Page ${i} of ${pageCount}`, pageWidth - margin, 285, { align: 'right' } ); } doc.save(`Automotive_Post_${topicInput.value.trim().replace(/\s/g, '_')}.pdf`); }).catch(err => { console.error("Error generating PDF:", err); alert("Could not generate PDF. See console for details."); }); }; const showTab = (tabNum) => { currentTab = tabNum; tabButtons.forEach(btn => btn.classList.toggle('active', parseInt(btn.dataset.tab) === tabNum)); tabPanes.forEach(pane => pane.classList.toggle('hidden', parseInt(pane.id.split('-')[2]) !== tabNum)); prevBtn.classList.toggle('invisible', currentTab === 1); nextBtn.textContent = currentTab === 1 ? 'Generate Post' : 'Generate Again'; }; // --- Event Listeners --- tabButtons.forEach(button => { button.addEventListener('click', () => { const tabNum = parseInt(button.dataset.tab); if (tabNum === 2 && currentTab === 1) generatePost(); showTab(tabNum); }); }); prevBtn.addEventListener('click', () => { if (currentTab > 1) showTab(currentTab - 1) }); nextBtn.addEventListener('click', () => { if (currentTab === 1) { generatePost(); showTab(2); } else { generatePost(); } }); downloadPdfBtn.addEventListener('click', downloadPdf); // --- Initial Setup --- showTab(1); });
Scroll to Top