Squarespace
Add astrology content to Squarespace sites using Code Injection or the Squarespace API.
Code Injection
Navigate to Settings > Advanced > Code Injection in your Squarespace dashboard. Add a custom HTML block in the Header or Footer section to load your astrology widget.
HTML/JS Example
Place this snippet in the Code Injection area. It fetches a daily horoscope and displays it on the page.
<div id="horoscope"></div>
<script>
fetch('${API_DOCS_URL}/api/astro/rashifal/daily/', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ rashi: 'aries' })
})
.then(r => r.json())
.then(data => {
document.getElementById('horoscope').innerText = data.get_daily_rashifal.general_prediction;
});
</script>Security Note
For production, proxy API calls through a backend to protect your key. Exposing your API key in client-side code allows anyone to use it.