Compare commits

..

23 Commits
master ... tmp

Author SHA1 Message Date
dev sp 2a3c99ace9 some file not find 2024-02-19 11:54:49 +00:00
dev sp f2fe34c82c deffiine path 2024-02-07 16:23:55 +00:00
dev sp 7593e3b823 edit news last worked 2024-02-05 15:55:48 +00:00
dev sp f378065344 remove weather 2024-01-24 14:07:59 +00:00
dev sp e59a1168ce change homepage desgine 2024-01-23 08:15:50 +00:00
dev sp 80e8bc4f91 add weater information 2024-01-19 16:25:38 +00:00
dev sp aeb9362f6d add htacces 2024-01-19 08:00:38 +00:00
dev sp 78d9081f87 add listening options 2024-01-19 07:57:07 +00:00
dev sp d4043d1678 try to add listening options 2024-01-18 17:27:57 +00:00
dev sp e90b7329c4 add publish date 2024-01-18 14:09:40 +00:00
dev sp 4982a72f0c change twitter link text 2024-01-17 16:18:06 +00:00
dev sp ee0bc8482a add 404 2024-01-17 07:30:35 +00:00
dev sp 318e7f4c48 add 404 2024-01-17 07:28:05 +00:00
dev sp 443422300d add 404 2024-01-17 07:25:07 +00:00
dev sp 37155aa643 add 404 2024-01-17 07:20:50 +00:00
dev sp 9191fb5642 done og image issue in facebook shares 2024-01-16 12:52:15 +00:00
dev sp 5d5c73b65b remove canonical from every pages 2024-01-16 12:15:23 +00:00
dev sp f808d907b0 change 2024-01-13 12:20:15 +00:00
dev sp 289a30d3ee change 2024-01-13 12:19:18 +00:00
dev sp e72c19dc49 change 2024-01-13 11:09:06 +00:00
dev sp 012c01469f change 2024-01-13 10:57:50 +00:00
dev sp 47717e7300 change 2024-01-13 10:48:31 +00:00
dev sp edb7796bcf add robot and sitemap 2024-01-13 08:45:10 +00:00
53 changed files with 3012 additions and 501 deletions

2
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,2 @@
{
}

View File

@ -4,8 +4,8 @@
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "astro dev --host --port 2023", "dev": "astro dev --host --port 2024",
"start": "astro dev --host --port 2023", "start": "astro dev --host --port 2024",
"build": "astro build", "build": "astro build",
"preview": "astro preview", "preview": "astro preview",
"push": "rsync -azP dist/ barta-india@51.222.206.100:/home/barta-india/public_html", "push": "rsync -azP dist/ barta-india@51.222.206.100:/home/barta-india/public_html",
@ -14,6 +14,8 @@
"dependencies": { "dependencies": {
"@astrojs/tailwind": "^2.1.3", "@astrojs/tailwind": "^2.1.3",
"@astrojs/vue": "^1.2.2", "@astrojs/vue": "^1.2.2",
"@bytescale/upload-widget-vue": "^4.13.0",
"@upload-io/vue-uploader": "^3.37.1",
"astro": "^1.7.2", "astro": "^1.7.2",
"astro-eslint-parser": "^0.14.0", "astro-eslint-parser": "^0.14.0",
"eslint": "^8.44.0", "eslint": "^8.44.0",

BIN
public/img/clear_sky.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

70
public/js/js-0.1.0.js Normal file
View File

@ -0,0 +1,70 @@
function getCookie(cname) {
let name = cname + "=";
let ca = document.cookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
const cookieValue = c.substring(name.length, c.length);
// console.log(`Cookie ${cname} found with value: ${cookieValue}`);
return cookieValue;
}
}
// console.log(`Cookie ${cname} not found`);
return "";
}
function makeProtectedRequest(apiUrl, renewUrl, access_token, formData) {
return fetch(apiUrl, {
method: 'POST',
// mode: "cors",
headers: {
// 'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
// credentials: 'same-origin',
body: JSON.stringify(formData),
})
.then(response => {
if (!response.ok) {
throw new Error('Request failed');
} else if(response.status === 204) {
// Token is expired or invalid, trigger refresh
// console.log(access_token)
return renewToken(renewUrl, access_token).then(access_token_new => {
// Retry the original request with the new token
// console.log("formData :" +access_token_new)
formData.access_token=access_token_new;
return fetch(apiUrl, {
method: 'POST',
headers: {
// 'Authorization': `Bearer ${newAccessToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(formData),
});
});
}
return response.json();
});
}
function renewToken(renewUrl, access_token) {
return fetch(renewUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ tokenToRenew: access_token }),
})
.then(response => response.json())
.then(data => {
document.cookie = `access_token=${data.access_token}; path=/`;
// console.log('New Access Token:', data);
return data.access_token;
});
}

9
public/robots.txt Normal file
View File

@ -0,0 +1,9 @@
User-agent: Googlebot
Disallow: /nogooglebot/
Disallow: /ad-file/
Disallow: /add-news/
User-agent: *
Allow: /
Sitemap: https://barta-india.in/sitemap.xml

367
public/sitemap.xml Normal file
View File

@ -0,0 +1,367 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
<url>
<loc>http://barta-india.in/</loc>
<lastmod>2024-01-12T16:29:37+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>http://barta-india.in/bn/</loc>
<lastmod>2024-01-12T16:29:46+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/national/</loc>
<lastmod>2024-01-12T16:29:40+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/politics/</loc>
<lastmod>2024-01-12T16:29:42+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/local/</loc>
<lastmod>2024-01-12T16:29:43+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/technology/</loc>
<lastmod>2024-01-12T16:29:38+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/contact/</loc>
<lastmod>2024-01-12T16:29:43+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/flipkart-is-offering-the-iphone15-for-rs68999-see-how-the-deal-works/</loc>
<lastmod>2024-01-12T16:30:26+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/first-t20-ibetween-new-zealandand-pakistan-finn-allen-hits-shaheen-afridi-for-24-runs-in-an-over-setting-a-record-for-the-mos-texpensive-over-in-t20-ihistory/</loc>
<lastmod>2024-01-12T16:30:26+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/west-bengal-minister-sujit-boseshomeisraidedbythe-ed-due-to-a-municipal-jobs-fraud/</loc>
<lastmod>2024-01-12T16:30:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/in-advance-of-the-ayodhya-ram-mandir-consecration-ceremony-pm-modi-starts-an11-day-anushthan/</loc>
<lastmod>2024-01-12T16:30:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/be-at-ease-everything-will-work-out-this-is-nitish-kumar-most-recent-assurancere-garding-seat-sharingin-bihar/</loc>
<lastmod>2024-01-12T16:30:24+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/in-manipur-four-villagers-were-kidnappedand-killedby-suspected-kuki-militants-including-father-son/</loc>
<lastmod>2024-01-12T16:30:24+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/mamata-banerjee-invites-pm-modi-to-visit-ganga-sagar-mela-despite-differences/</loc>
<lastmod>2024-01-12T16:30:23+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/mamata-banerjee-rejects-one-nation-one-election-writing-to-the-kovind-led-panel-that-it/</loc>
<lastmod>2024-01-12T16:30:22+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/article/</loc>
<lastmod>2024-01-12T06:57:29+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/terms-and-conditions/</loc>
<lastmod>2024-01-12T16:29:37+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/privacy-policy/</loc>
<lastmod>2024-01-12T16:29:37+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/</loc>
<lastmod>2024-01-12T16:29:49+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/politics/</loc>
<lastmod>2024-01-12T16:29:57+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/local/</loc>
<lastmod>2024-01-12T16:30:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/technology/</loc>
<lastmod>2024-01-12T16:29:47+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/shuvendu-adhikari-responding-to-eds-harassment-says-start-packing-bags-keep-winter-stuff-too/</loc>
<lastmod>2024-01-12T16:30:21+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/mercury-fell-before-makar-sankranti-what-is-the-temperature-of-kolkata-now/</loc>
<lastmod>2024-01-12T16:30:21+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/india-vs-afghanistan-ind-vs-afg-1st-t20-ilive-cricket-scorecard-updates-team-indiaface-afghanistanin-mohali/</loc>
<lastmod>2024-01-12T16:30:19+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/sonu-sood-released-his-new-film-fateh-gift-which-is-a-tribute-to-cybercrime-victims/</loc>
<lastmod>2024-01-12T16:30:18+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/finance-minister-nirmala-sitharaman-is-al-lset-to-present-the-interim-budgeton-february1/</loc>
<lastmod>2024-01-12T16:30:18+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/personally-dasand-rbi-as-an-institution-are-opposed-to-private-cryptocurrencies-on-the-grounds-that-they-pose-tremendous-threat-to-the-financial-stability/</loc>
<lastmod>2024-01-12T16:30:16+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/chandigarh-jaipur-earthquake-residentsin-chandigarh-jaipur-delhi-gurugram-noida-and-surrounding-are-as-felt-mild-tremors/</loc>
<lastmod>2024-01-12T16:30:15+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/the-stamp-bear-stheyear-2024-in-vikram-samvatthe-hindu-calendar-thatis-followed-in-nepal-and-some-parts-of-india/</loc>
<lastmod>2024-01-12T16:30:14+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/watchthe29th-critics-choice-awards-liv-eon-lionsgate-playon15th-january-2023/</loc>
<lastmod>2024-01-12T16:30:14+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/raptee-energy-showcases-high-voltage-electric-motorcycle-at-global-investors-meet2024/</loc>
<lastmod>2024-01-12T16:30:13+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/high-traar-queen-whois-mallika-srinivasan-1000-cror-erevenue-company-sanswer-trailblazer-woman/</loc>
<lastmod>2024-01-12T16:30:12+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/after-galwan-china-admits-india-is-no-longer-a-weak-nation-rajnath-singh/</loc>
<lastmod>2024-01-12T16:30:12+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/flipkart-republic-day-big-deal-sale-2024-date-announced-know-the-offers-on-smartphones/</loc>
<lastmod>2024-01-12T16:30:11+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/polycab-india-shares-jump-after-cable-and-wire-craftsman-denies-tax-evasion-reports/</loc>
<lastmod>2024-01-12T16:30:10+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/government-plan-that-empower-women-making-them-economically-strong/</loc>
<lastmod>2024-01-12T16:30:10+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/kolkata-accident-audi-car-collided-with-van-allegedly-rude-behave-with-police-after-being-detained/</loc>
<lastmod>2024-01-12T16:30:09+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/tmc-mp-abhishek-banerjee-petition-to-supreme-court-against-calcutta-high-court-justices-abhijit-gangopadhyay-and-amrita-sinha-s-remarks/</loc>
<lastmod>2024-01-12T16:30:07+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/sandeep-lamichhane-nepal-cricketer-gets-8-years-in-jail-for-physical-rape-get-to-know/</loc>
<lastmod>2024-01-12T16:30:07+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/north-24-pargana-physically-challenged-youth-going-to-ayodhya-ram-mandir-on-ramlalla-pran-pratistha-event-on-bicycle/</loc>
<lastmod>2024-01-12T16:30:06+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/tmc-supremo-mamatabanerjee-caution-party-members-for-inner-battle/</loc>
<lastmod>2024-01-12T16:30:05+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/bjp-suvenduadhikari-invasion-cpm-refer-minakshi-mukherjees-candidateship-from-nadigram/</loc>
<lastmod>2024-01-12T16:30:04+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/congress-will-not-attend-ram-mandir-commencement-in-ayodhya-calls-it-bjp-rss-event/</loc>
<lastmod>2024-01-12T16:30:04+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/national/in-advance-of-the-ayodhya-ram-mandir-consecration-ceremony-pm-modi-starts-an11-day-anushthan/</loc>
<lastmod>2024-01-12T16:29:41+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/national/mamata-banerjee-invites-pm-modi-to-visit-ganga-sagar-mela-despite-differences/</loc>
<lastmod>2024-01-12T16:29:40+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/politics/be-at-ease-everything-will-work-out-this-is-nitish-kumar-most-recent-assurancere-garding-seat-sharingin-bihar/</loc>
<lastmod>2024-01-12T16:29:43+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/politics/mamata-banerjee-rejects-one-nation-one-election-writing-to-the-kovind-led-panel-that-it/</loc>
<lastmod>2024-01-12T16:29:42+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/local/in-manipur-four-villagers-were-kidnappedand-killedby-suspected-kuki-militants-including-father-son/</loc>
<lastmod>2024-01-12T16:29:45+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/technology/flipkart-is-offering-the-iphone15-for-rs68999-see-how-the-deal-works/</loc>
<lastmod>2024-01-12T16:29:39+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/article/in-manipur-four-villagers-were-kidnappedand-killedby-suspected-kuki-militants-including-father-son/</loc>
<lastmod>2024-01-12T06:57:29+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/finance-minister-nirmala-sitharaman-is-al-lset-to-present-the-interim-budgeton-february1/</loc>
<lastmod>2024-01-12T16:29:56+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/personally-dasand-rbi-as-an-institution-are-opposed-to-private-cryptocurrencies-on-the-grounds-that-they-pose-tremendous-threat-to-the-financial-stability/</loc>
<lastmod>2024-01-12T16:29:55+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/the-stamp-bear-stheyear-2024-in-vikram-samvatthe-hindu-calendar-thatis-followed-in-nepal-and-some-parts-of-india/</loc>
<lastmod>2024-01-12T16:29:55+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/high-traar-queen-whois-mallika-srinivasan-1000-cror-erevenue-company-sanswer-trailblazer-woman/</loc>
<lastmod>2024-01-12T16:29:54+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/after-galwan-china-admits-india-is-no-longer-a-weak-nation-rajnath-singh/</loc>
<lastmod>2024-01-12T16:29:54+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/polycab-india-shares-jump-after-cable-and-wire-craftsman-denies-tax-evasion-reports/</loc>
<lastmod>2024-01-12T16:29:53+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/government-plan-that-empower-women-making-them-economically-strong/</loc>
<lastmod>2024-01-12T16:29:52+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/sandeep-lamichhane-nepal-cricketer-gets-8-years-in-jail-for-physical-rape-get-to-know/</loc>
<lastmod>2024-01-12T16:29:51+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/north-24-pargana-physically-challenged-youth-going-to-ayodhya-ram-mandir-on-ramlalla-pran-pratistha-event-on-bicycle/</loc>
<lastmod>2024-01-12T16:29:51+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/national/congress-will-not-attend-ram-mandir-commencement-in-ayodhya-calls-it-bjp-rss-event/</loc>
<lastmod>2024-01-12T16:29:50+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/politics/shuvendu-adhikari-responding-to-eds-harassment-says-start-packing-bags-keep-winter-stuff-too/</loc>
<lastmod>2024-01-12T16:29:59+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/politics/tmc-mp-abhishek-banerjee-petition-to-supreme-court-against-calcutta-high-court-justices-abhijit-gangopadhyay-and-amrita-sinha-s-remarks/</loc>
<lastmod>2024-01-12T16:29:58+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/politics/tmc-supremo-mamatabanerjee-caution-party-members-for-inner-battle/</loc>
<lastmod>2024-01-12T16:29:58+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/politics/bjp-suvenduadhikari-invasion-cpm-refer-minakshi-mukherjees-candidateship-from-nadigram/</loc>
<lastmod>2024-01-12T16:29:57+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/local/mercury-fell-before-makar-sankranti-what-is-the-temperature-of-kolkata-now/</loc>
<lastmod>2024-01-12T16:30:02+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/local/sonu-sood-released-his-new-film-fateh-gift-which-is-a-tribute-to-cybercrime-victims/</loc>
<lastmod>2024-01-12T16:30:02+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/local/watchthe29th-critics-choice-awards-liv-eon-lionsgate-playon15th-january-2023/</loc>
<lastmod>2024-01-12T16:30:01+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/local/kolkata-accident-audi-car-collided-with-van-allegedly-rude-behave-with-police-after-being-detained/</loc>
<lastmod>2024-01-12T16:30:01+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/technology/raptee-energy-showcases-high-voltage-electric-motorcycle-at-global-investors-meet2024/</loc>
<lastmod>2024-01-12T16:29:48+00:00</lastmod>
<priority>0.51</priority>
</url>
<url>
<loc>http://barta-india.in/bn/technology/flipkart-republic-day-big-deal-sale-2024-date-announced-know-the-offers-on-smartphones/</loc>
<lastmod>2024-01-12T16:29:48+00:00</lastmod>
<priority>0.51</priority>
</url>
</urlset>

23
src/components/About.vue Normal file
View File

@ -0,0 +1,23 @@
<template>
<div>
<h1 class="text-4xl">About Page Content</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
</div>
</template>
<script>
export default {
name: 'About'
};
</script>
<style>
p{
font-size: 20px;
}
</style>

144
src/components/EditNews.vue Normal file
View File

@ -0,0 +1,144 @@
<template>
<div class="my-10">
<section class="container mx-auto px-4 max-w-2xl shadow-lg rounded-xl p-6">
<div class="flex flex-row place-content-evenly">
<a :href="'?edit=' + bartaData.slug + '&lang=en'" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">English</a>
<a :href="'?edit=' + bartaData.slug + '&lang=bn'" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">Bengali</a>
<a :href="'?edit=' + bartaData.slug + '&lang=hi'" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">Hindi</a>
<a :href="'?edit=' + bartaData.slug + '&lang=zh'" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">Mandarin</a>
<a :href="'?edit=' + bartaData.slug + '&lang=es'" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">Spanish</a>
</div>
<p class="text-2xl py-4">Edit News</p>
<form id="newsForm" class="flex flex-col space-y-4">
<div class="flex flex-col">
<label for="status">Status<span class="text-[#580a0a] font-bold">*</span></label>
<select name="status" id="status" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" required>
<option :value="bartaData.status">{{ bartaData.status }}</option>
<option value="published">Published</option>
<option value="draft">Draft</option>
<option value="archived">Archived</option>
</select>
</div>
<div class="flex flex-col">
<label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
<select name="language" id="language" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" required>
<option value="null">-Select-</option>
<option value="bengali">Bengali</option>
<option value="english">English</option>
</select>
</div>
<div class="flex flex-col">
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
<option value="national">National</option>
<option value="politics">Politics</option>
<option value="local">Local</option>
<option value="technology">Technology</option>
<option value="world">World</option>
</select>
</div>
<div class="flex flex-col">
<label for="title">Title<span class="text-[#580a0a] font-bold">*</span></label>
<input :value="bartaData.title" name="title" id="title" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
</div>
<div class="flex flex-col">
<label for="slug">Slug<span class="text-[#580a0a] font-bold">*</span></label>
<input oninput="updateSlug();" name="slug" id="slug" :value="bartaData.slug" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
</div>
<div class="flex flex-col">
<label for="heading">Heading<span class="text-[#580a0a] font-bold">*</span></label>
<input :value="bartaData.heading" name="heading" id="heading" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
</div>
<div class="flex flex-col">
<label for="meta_title">Meta Title<span class="text-[#580a0a] font-bold">*</span></label>
<input :value="bartaData.meta_title" name="meta_title" id="meta_title" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 60 characters & try to use common words" required>
</div>
<div class="flex flex-col">
<label for="meta_description">Meta Description<span class="text-[#580a0a] font-bold">*</span></label>
<input :value="bartaData.meta_description" name="meta_description" id="meta_description" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 160 characters & try to use common words" required>
</div>
<div class="flex flex-col">
<label for="in_brief">In Brief<span class="text-[#580a0a] font-bold">*</span></label>
<input :value="bartaData.in_brief" name="in_brief" id="in_brief" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 280 characters & try to descibe" required>
</div>
<div class="flex flex-col">
<label class="text-lg" for="content">News Description<span class="text-[#580a0a] font-bold">*</span></label>
<textarea class="border-2 p-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" name="content" id="content" cols="30" rows="10" required>{{ bartaData.content }}</textarea>
</div>
<div class="flex flex-col">
<label for="upldFile">Upload File</label>
<input id="upldFile" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" type="file">
</div>
<div class="flex float-right">
<button onclick="callApi(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">Save</button>
</div>
</form>
</section>
</div>
</template>
<script>
export default {
data() {
return {
slugURLbn: "",
fullURL: "",
spliturl: "",
bartaData: {}, // Initialize bartaData as an object
bnData: {},
};
},
mounted() {
this.getBarta();
let fullURL = window.location.href.split("/")[4];
// console.log(fullURL + '&lang=en')
},
methods: {
getBarta() {
let currentUrl = window.location.href;
let langValue = currentUrl.split("/")[4].split("lang=")[1];
let spliturl = currentUrl.split("/")[4].split("edit=")[1].split(`lang=${langValue}`)[0].split(`&`)[0];
console.log(spliturl);
let formData = new FormData();
formData.append('slug', spliturl);
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/edit-news/?action=news_${langValue}`, {
method: 'POST',
body: formData,
})
.then(response => response.json())
.then(data => {
// Assign fetched data to bartaData property
// console.log(data)
this.bartaData = data;
console.log(this.bartaData)
})
.catch(error => {
// console.log('An error occurred', error);
});
},
// getBartaBN() {
// let currentUrl = window.location.href;
// let spliturl = currentUrl.split("/")[3].split("edit=")[1];
// // console.log(spliturl);
// let formData = new FormData();
// formData.append('slug', spliturl);
// fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/edit-news/?action=news_bn`, {
// method: 'POST',
// body: formData,
// })
// .then(response => response.json())
// .then(data => {
// // Assign fetched data to bartaData property
// // console.log(data)
// this.bnData = data;
// console.log(this.bnData)
// })
// .catch(error => {
// // console.log('An error occurred', error);
// });
// },
},
};
</script>

View File

@ -26,10 +26,21 @@
<!-- <a href="/contact">Contact</a> --> <!-- <a href="/contact">Contact</a> -->
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<div class="flex bg-[#780a0a] text-white justify-center place-items-center border-t-4 border-white py-4"> <div class="flex bg-[#780a0a] text-white justify-center place-items-center border-t-4 border-white py-4">
<a href="https://dwd.siliconpin.com/" target="_blank">Powered by <span class="font-bold">DWD Consultancy Services</span></a> <a href="https://dwd.siliconpin.com/" target="_blank">Powered by <span class="font-bold">DWD Consultancy Services</span></a>
</div> </div>
</div> </div>
</main> </main>
<script defer type="text/javascript" src="/js/js-0.1.0.js"></script>
<!-- Google tag (gtag.js) -->
<script is:inline async src="https://www.googletagmanager.com/gtag/js?id=G-GXF4D64859"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-GXF4D64859');
</script>

View File

@ -0,0 +1,103 @@
<template>
<div id="app">
<div>
<!-- <a href="#/" @click.prevent="navigateTo('/')">Home</a> |
<a href="#/about" @click.prevent="navigateTo('/about')">About</a> -->
</div>
<div>
<!-- <component :is="currentComponent"></component> -->
</div>
</div>
</template>
<!-- <script>
import Home from './Home.vue';
import About from './About.vue';
export default {
name: 'App',
data() {
return {
currentRoute: window.location.hash.substr(1),
routes: {
'/': Home,
'/about': About
}
};
},
computed: {
currentComponent() {
return this.routes[this.currentRoute] || Home;
}
},
methods: {
navigateTo(route) {
this.currentRoute = route;
}
},
watch: {
currentRoute() {
window.location.hash = this.currentRoute;
}
}
};
</script> -->
<style>
/* Add your styles here if needed */
</style>
<!-- <template>
<div>
<div class="flex flex-row space-4 z-10 my-20">
<a href="#section1">Section - 1</a>
<a href="#section2">Section - 2</a>
<a href="#section3">Section - 3</a>
</div>
<section id="section1">
<div>
<h1 class="text-4xl">Section - 1</h1>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Veritatis rem id distinctio officia odio, quasi ratione perferendis. Soluta delectus aspernatur, dicta voluptatibus autem consectetur, error, enim saepe possimus quidem ex?</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
</div>
</section>
<section id="section2">
<div>
<h1 class="text-4xl">Section - 1</h1>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Veritatis rem id distinctio officia odio, quasi ratione perferendis. Soluta delectus aspernatur, dicta voluptatibus autem consectetur, error, enim saepe possimus quidem ex?</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
</div>
</section>
<section id="section3">
<div>
<h1 class="text-4xl">Section - 1</h1>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Veritatis rem id distinctio officia odio, quasi ratione perferendis. Soluta delectus aspernatur, dicta voluptatibus autem consectetur, error, enim saepe possimus quidem ex?</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Repellat eaque quas maiores doloremque. Esse quos aliquam doloremque impedit consequatur, dignissimos exercitationem quaerat incidunt numquam voluptatum quae deserunt voluptas quod laboriosam.</p>
</div>
</section>
</div>
</template>
<style>
p{
font-size: 20px;
}
</style> -->

22
src/components/Home.vue Normal file
View File

@ -0,0 +1,22 @@
<template>
<div>
<h1 class="text-4xl">Home Page Content</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, ipsam! Nisi aspernatur quibusdam soluta commodi labore optio? Molestias quasi fugiat voluptatibus impedit laboriosam cumque illo alias repellendus, similique minus ullam.</p>
</div>
</template>
<script>
export default {
name: 'Home'
};
</script>
<style>
p{
font-size: 20px;
}
</style>

View File

@ -0,0 +1,37 @@
<template>
<!-- <button @click="uploadFile">Upload a file...</button> -->
</template>
<!-- <script lang="ts">
import { openUploadModal } from "@bytescale/upload-widget-vue";
import type { UploadWidgetConfig, UploadWidgetResult } from "@bytescale/upload-widget";
import type { PreventableEvent } from "@bytescale/upload-widget-vue";
// -----
// Configuration:
// https://www.bytescale.com/docs/upload-widget#configuration
// -----
const options: UploadWidgetConfig = {
apiKey: "public_W142iS49Lc7EEN1moVR4ekPmkG13", // Get API key: https://www.bytescale.com/get-started
maxFileCount: 10
};
export default {
name: "App",
methods: {
uploadFile(event: PreventableEvent) {
openUploadModal({
event,
options,
onComplete: (files: UploadWidgetResult[]) => {
if (files.length === 0) {
alert("No files selected.");
} else {
alert(files.map(f => f.fileUrl).join("\n"));
}
}
})
}
}
};
</script> -->

View File

@ -0,0 +1,140 @@
<main>
<div>
<section class="container mx-auto px-4">
<div id="swicthDIVBG">
<p id="cityName"></p>
<p id="temper"></p>
<p id="description"></p>
</div>
</section>
<div class="flex flex-col justify-center place-items-center fixed top-[50%] right-[50%] bg-white md:max-w-lg w-full p-6 rounded-2xl shadow-xl" style="display: none;" id="weatherPermission">
<p>know weather information allow location Permission</p>
<div class="flex flex-row gap-6">
<button id="yesButton" class="border-2 border-[#580a0a] text-[#580a0a] px-4 py-2 rounded-xl">Allow</button>
<button id="noButton" class="border-2 border-[#580a0a] text-[#580a0a] px-4 py-2 rounded-xl">Deny</button>
</div>
</div>
<!-- <div class="bg-red-500 text-black" id="weatherInfo"></div> -->
</div>
</main>
<script is:inline>
async function getCurrentLocation() {
return new Promise((resolve, reject) => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => resolve(position.coords),
(error) => reject(error)
);
} else {
reject(new Error('Geolocation is not supported by this browser.'));
}
});
}
async function getCityName(latitude, longitude) {
const apiKey = '4d54049b61eb45c4b121ab2cff9808ba'; // Replace with your OpenCage API key
const apiUrl = `https://api.opencagedata.com/geocode/v1/json?q=${latitude}+${longitude}&key=${apiKey}`;
try {
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error('Error fetching data from the server.');
}
const data = await response.json();
if (data.results && data.results.length > 0) {
const city = data.results[0].components.city;
return city;
} else {
throw new Error('City not found.');
}
} catch (error) {
console.error('Error:', error.message);
throw new Error('Error fetching city name.');
}
}
async function getWeatherData(city) {
const apiKey = 'aed8dd87581613e1d2bbbf63eeb618da';
const apiUrl = `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${apiKey}`;
try {
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error('Error fetching weather data from the server.');
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error:', error.message);
throw new Error('Error fetching weather data.');
}
}
async function showCityName() {
try {
const location = await getCurrentLocation();
const city = await getCityName(location.latitude, location.longitude);
// document.getElementById('weatherInfo').innerText = 'Current City: ' + city;
const weatherData = await getWeatherData(city);
displayWeather(weatherData);
} catch (error) {
console.error(error.message);
// document.getElementById('weatherInfo').innerText = 'Error fetching data.';
}
}
function displayWeather(data) {
// const weatherInfoDiv = document.getElementById('weatherInfo');
// Extract relevant information from the API response
const cityName = data.name;
const temperature = data.main.temp;
const description = data.weather[0].description;
document.getElementById('cityName').innerHTML= 'City: ' + cityName;
document.getElementById('temper').innerHTML = 'Temperature: ' + temperature;
document.getElementById('description').innerHTML = 'Description: ' + description;
let switchBG = document.innerHTML = description;
if (switchBG === 'clear sky') {
let clearSkyBG = document.getElementById('swicthDIVBG').style.backgroundImage = 'url(/img/clear_sky.webp)';
clearSkyBG.style.backgroundRepeat = 'no-repeat';
clearSkyBG.style.backgroundSize = 'cover';
}
// Display the weather information switchDiv.style.backgroundImage = 'url("path/to/clear-sky-image.jpg")';
// weatherInfoDiv.innerHTML = `
// <p>City: ${cityName}</p>
// <p>Temperature: ${temperature} °C</p>
// <p>Description: ${description}</p>
// `;
}
function windowOnload() {
document.getElementById('weatherPermission').style.display = 'block';
// Attach click event handlers to the buttons
document.getElementById('yesButton').addEventListener('click', onYesButtonClick);
document.getElementById('noButton').addEventListener('click', onNoButtonClick);
}
function onYesButtonClick() {
// Call the function to display the city name and weather information
showCityName();
// Hide the weather permission div
document.getElementById('weatherPermission').style.display = 'none';
}
function onNoButtonClick() {
// Hide the weather permission div without fetching weather information
document.getElementById('weatherPermission').style.display = 'none';
}
window.onload = windowOnload;
</script>

View File

@ -1,6 +1,7 @@
--- ---
import MainHeader from '../components/MainHeader.astro'; import MainHeader from '../components/MainHeader.astro';
import Footer from '../components/Footer.astro'; import Footer from '../components/Footer.astro';
import WeatherandTime from '../components/WeatherandTime.astro';
export interface Props { export interface Props {
title: string; metaTitle: string; description: string; ogImg: string; tiwtterCard: string; tiwtterImage: string; tiwtterTitle: string; tiwtterDesc: string; tiwtterURL: string; artPubTime: string; artUpdtTime: string; ogSiteName: string; ogType: string; ogTitle: string; ogDesc: string; ogURL: string; canonical: string; title: string; metaTitle: string; description: string; ogImg: string; tiwtterCard: string; tiwtterImage: string; tiwtterTitle: string; tiwtterDesc: string; tiwtterURL: string; artPubTime: string; artUpdtTime: string; ogSiteName: string; ogType: string; ogTitle: string; ogDesc: string; ogURL: string; canonical: string;
} }
@ -36,29 +37,30 @@ const { title, metaTitle, description, ogImg, tiwtterCard, tiwtterImage, tiwtter
<meta property="og:image:width" content="526" /> <meta property="og:image:width" content="526" />
<meta property="og:image:height" content="275" /> <meta property="og:image:height" content="275" />
<meta name="og:image:secure_url" content={ogImg} /> <meta name="og:image:secure_url" content={ogImg} />
<script type="application/ld+json"> <!-- <script type="application/ld+json">
{ {
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": "Website", "@type": "News Portal",
"name": "Barta India", "name": "Barta India",
"url": "https://barta-india.in/", "url": "https://barta-india.in/",
"logo": "/img/barta_logo.png", "logo": "/img/barta_logo.png",
"contactPoint": { "contactPoint": {
"@type": "https://barta-india.in/contact/", "@type": "ContactPoint",
"contactType": "Visitor Feedback" "contactType": "Visitor Feedback",
"url": "https://barta-india.in/contact/",
}, },
"sameAs": [ "sameAs": [
"https://www.facebook.com/bartaindia?mibextid=eHce3h", "https://www.facebook.com/bartaindia?mibextid=eHce3h",
] ]
} }
</script> </script> -->
</head> </head>
<body> <body>
<div> <div>
<MainHeader /> <MainHeader />
</div> </div>
<div class="mt-[150px]"> <div class="mt-[100px]">
<!-- <WeatherandTime /> -->
<slot /> <slot />
</div> </div>
<Footer /> <Footer />

View File

@ -1,6 +1,5 @@
--- ---
import MainHeaderBN from '../components/MainHeaderBN.astro'; import MainHeaderBN from '../components/MainHeaderBN.astro';
import TopHeader from '../components/TopHeader.astro';
import Footer from '../components/Footer.astro'; import Footer from '../components/Footer.astro';
export interface Props { export interface Props {
title: string; metaTitle: string; description: string; ogImg: string; tiwtterCard: string; tiwtterImage: string; tiwtterTitle: string; tiwtterDesc: string; tiwtterURL: string; artPubTime: string; artUpdtTime: string; ogSiteName: string; ogType: string; ogTitle: string; ogDesc: string; ogURL: string; canonical: string; title: string; metaTitle: string; description: string; ogImg: string; tiwtterCard: string; tiwtterImage: string; tiwtterTitle: string; tiwtterDesc: string; tiwtterURL: string; artPubTime: string; artUpdtTime: string; ogSiteName: string; ogType: string; ogTitle: string; ogDesc: string; ogURL: string; canonical: string;
@ -15,8 +14,8 @@ const { title, metaTitle, description, ogImg, tiwtterCard, tiwtterImage, tiwtter
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/ico+xml" href="/favicon.ico" /> <link rel="icon" type="image/ico+xml" href="/favicon.ico" />
<link rel="canonical" href={canonical} />
<meta name="generator" content="barta-india.in html generator" /> <meta name="generator" content="barta-india.in html generator" />
<link rel="canonical" href={canonical} />
<title>{title}</title> <title>{title}</title>
<meta name="title" content={metaTitle}> <meta name="title" content={metaTitle}>
<meta name="description" content={description}> <meta name="description" content={description}>
@ -37,27 +36,27 @@ const { title, metaTitle, description, ogImg, tiwtterCard, tiwtterImage, tiwtter
<meta property="og:image:width" content="526" /> <meta property="og:image:width" content="526" />
<meta property="og:image:height" content="275" /> <meta property="og:image:height" content="275" />
<meta name="og:image:secure_url" content={ogImg} /> <meta name="og:image:secure_url" content={ogImg} />
<script type="application/ld+json"> <!-- <script type="application/ld+json">
{ {
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": "Website", "@type": "News Portal",
"name": "Barta India", "name": "Barta India",
"url": "https://barta-india.in/bn", "url": "https://barta-india.in/bn",
"logo": "/img/barta_logo.png", "logo": "/img/barta_logo.png",
"contactPoint": { "contactPoint": {
"@type": "https://barta-india.in/contact/", "@type": "ContactPoint",
"contactType": "Visitor Feedback" "contactType": "Visitor Feedback",
"url": "https://barta-india.in/contact/",
}, },
"sameAs": [ "sameAs": [
"https://www.facebook.com/bartaindia?mibextid=eHce3h", "https://www.facebook.com/bartaindia?mibextid=eHce3h",
] ]
} }
</script> </script> -->
</head> </head>
<body> <body>
<div> <div>
<MainHeaderBN /> <MainHeaderBN />
</div> </div>
<div class="mt-[150px]"> <div class="mt-[150px]">
<slot /> <slot />

22
src/pages/404.astro Normal file
View File

@ -0,0 +1,22 @@
---
import Layout from "../layouts/Layout.astro";
// import EditNews from "../../components/EditNews.vue";
---
<Layout title="404 page not founf | Barta-India">
<main>
<div>
<p class="text-center">404 | Page Not Found</p>
<!-- <EditNews client:visible /> -->
</div>
</main>
<!-- </Layout>
<script is:inline>
let pramsURL = document.location.href.split('/')[3].split('edit=')[1];
document.getElementById('url').innerHTML = pramsURL;
// console.log(pramsURL)
function getNewsData(){
}
</script> -->

81
src/pages/4041.astro Normal file
View File

@ -0,0 +1,81 @@
---
import Layout from "../layouts/Layout.astro";
// import ImageUpload from "../components/ImageUpload.vue";
---
<Layout title="">
<main>
<div class="container mx-auto px-4 mt-40">
<!-- <ImageUpload client:visible /> -->
<h1 id="newsTitle"></h1>
<div id="my-container" style="position: relative; margin: 0 auto; width: 80%; height: 350px;"></div>
</div>
</main>
</Layout>
<script is:inline src="https://js.bytescale.com/upload-widget/v4"></script>
<script is:inline>
// Make the POST request using fetch
let slug = window.location.href.split('slug=')[1];
// console.log(fullURL)
let formData = new FormData;
formData.append('slug', slug)
const apiUrl = 'https://apisp.dev2.cicdhosting.com/news/get-news/?action=getslug';
fetch(apiUrl, {
method: 'POST',
body: formData, // Include the postData here
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json();
})
.then(data => {
console.log('POST request successful:', data);
document.getElementById('newsTitle').innerHTML = data.title;
// Handle the data from the server
})
.catch(error => {
console.error('Error during POST request:', error);
// Handle errors
});
// -----
// Configuration:
// https://www.bytescale.com/docs/upload-widget#configuration
// -----
const options = {
apiKey: "public_W142iS49Lc7EEN1moVR4ekPmkG13", // Get API key: https://www.bytescale.com/get-started
maxFileCount: 10,
// Dropzone configuration:
layout: "inline",
container: "#my-container",
showFinishButton: true,
// To remove the 'finish' button:
// showFinishButton: false,
// onUpdate: ({ uploadedFiles, pendingFiles, failedFiles }) => {
// const fileUrls = uploadedFiles.map(x => x.fileUrl).join("\n");
// if (fileUrls.length > 0) {
// alert(`File(s) uploaded:\n\n${fileUrls}`);
// }
// }
};
// console.log(options.container)
// import * as Bytescale from "@bytescale/upload-widget";
Bytescale.UploadWidget.open(options).then(
files => {
const fileUrls = files.map(x => x.fileUrl).join("\n");
const success = fileUrls.length === 0
? "No file selected."
: `File uploaded:\n\n${fileUrls}`;
alert(success);
},
error => {
alert(error);
}
);
</script>

View File

@ -13,53 +13,78 @@ const data = await response.json();
const { id } = Astro.params; const { id } = Astro.params;
const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===id); const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===id);
const items = data.data[idx]; const items = data.data[idx];
// console.log(data.data[idx]) // console.log(items.meta_title, items.meta_description)
--- ---
<!-- title, metaTitle, description, ogImg, tiwtterCard, tiwtterImage, tiwtterTitle, tiwtterDesc, tiwtterURL, artPubTime, artUpdtTime, ogSiteName, ogType, ogTitle, ogDesc, ogURL --> <!-- title, metaTitle, description, ogImg, tiwtterCard, tiwtterImage, tiwtterTitle, tiwtterDesc, tiwtterURL, artPubTime, artUpdtTime, ogSiteName, ogType, ogTitle, ogDesc, ogURL -->
<Layout title={items.title} <Layout title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/${items.slug}` tiwtterURL=`https://barta-india.in/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/${items.slug}` ogSiteName=`https://barta-india.in/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/${items.slug}` ogURL=`https://barta-india.in/${items.slug}`
canonical=`https://barta-india.in/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
<p class="text-xl font-bold text-[#780a0a]">Share on: </p> <p class="text-xl font-bold text-[#780a0a]">Share on: </p>
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a> <a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> <a href=`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a href=`http://www.x.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a> <!-- <a href=`https://www.facebook.com/share.php?u=https://barta-india.in/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> -->
<a href=`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> <a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div> </div>
</div> </div>
<p class="text-justify text-red-700 mt-4" set:html={items.content}></p> <p id="message3" class="text-justify text-red-700 mt-4" set:html={items.content}></p>
</div> </div>
</section> </section>
</main> </main>
</Layout> </Layout>
<script is:inline> <script is:inline>
// let whatsAppurl = document.location.href; let isListening = false;
// console.log(whatsAppurl); let speechSynthesisInstance = window.speechSynthesis;
// document.getElementById('whatsappURL').href = `whatsapp://send?text=${whatsAppurl}`;
// document.getElementById('whatsappURL').href = `whatsapp://send?text=Sample Text%20goes%20here%20-%20${whatsAppurl}` function toggleSpeech() {
if (isListening) {
stopSpeech();
} else {
startSpeech();
}
}
function startSpeech() {
let message1 = document.getElementById('message1').innerText;
let message2 = document.getElementById('message2').innerText;
let allSpeechText = message1 + ' ' + message2;
let speechText = new SpeechSynthesisUtterance(allSpeechText);
speechSynthesisInstance.speak(speechText);
document.getElementById('listenButton').innerText = 'Stop';
isListening = true;
}
function stopSpeech() {
speechSynthesisInstance.cancel();
document.getElementById('listenButton').innerText = 'Listen';
isListening = false;
}
</script> </script>
<style> <style>
section > div > p > p { section > div > p > p {

View File

@ -15,37 +15,37 @@ const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===
const items = data.data[idx]; const items = data.data[idx];
// console.log(data.data[idx]) // console.log(data.data[idx])
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/bn/${items.slug}` tiwtterURL=`https://barta-india.in/bn/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/bn/${items.slug}` ogSiteName=`https://barta-india.in/bn/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/bn/${items.slug}` ogURL=`https://barta-india.in/bn/${items.slug}`
canonical=`https://barta-india.in/bn/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
<p class="text-xl font-bold text-[#780a0a]">Share on: </p> <p class="text-xl font-bold text-[#780a0a]">Share on: </p>
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a> <a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> <a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/${items.slug}&text=Your%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a> <a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> <a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div> </div>
</div> </div>
@ -54,6 +54,42 @@ const items = data.data[idx];
</section> </section>
</main> </main>
</LayoutBN> </LayoutBN>
<script is:inline>
let isListening = false;
let speechSynthesisInstance = window.speechSynthesis;
function toggleSpeech() {
if (isListening) {
stopSpeech();
} else {
startSpeech();
}
}
function startSpeech() {
let message1 = document.getElementById('message1').innerText;
let message2 = document.getElementById('message2').innerText;
let allSpeechText = message1 + ' ' + message2;
let speechText = new SpeechSynthesisUtterance(allSpeechText);
speechText.lang = 'bn'; // Set language to Bengali
speechSynthesisInstance.speak(speechText);
document.getElementById('listenButton').innerText = 'Stop';
isListening = true;
}
function stopSpeech() {
speechSynthesisInstance.cancel();
document.getElementById('listenButton').innerText = 'Listen';
isListening = false;
}
// if(window.location.reload()){
// isListening = false;
// }
</script>
<style> <style>
section > div > p > p { section > div > p > p {
text-align: justify; text-align: justify;

View File

@ -12,54 +12,71 @@ const items = metaJSON.data[0];
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.description} description={items.description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.title}
tiwtterDesc={items.description} tiwtterDesc={items.description}
tiwtterURL=`https://barta-india.in/bn` tiwtterURL=`https://barta-india.in/bn`
ogSiteName=`https://barta-india.in/bn` ogSiteName=`https://barta-india.in/bn`
ogType={items.og_type} ogType={items.og_type}
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in/bn` ogURL=`https://barta-india.in/bn`
canonical=`https://barta-india.in/bn` >
>
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<div class="my-16"> <div class="my-16">
<span class="text-[#780a0a] font-bold" id="pageName"></span> <span class="text-[#780a0a] font-bold" id="pageName"></span>
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/bn/${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/bn/${items.slug}`}>
<img class="aspect-video " src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} /> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<div class="h-[100px] overflow-y-hidden"> <h2 class="text-lg text-justify ">{items.title}</h2>
<p id="" set:html={items.content}></p> </a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/bn/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div> </div>
</div> </div>
<div class="flex justify-end"> <div class="flex flex-row place-content-between">
<a href={`/bn/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a> <button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
</div> <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/bn/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div>
</div> </div>
)} )}
</div> <!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
<!-- <div class="flex flex-col"> </div>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </section>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main> </main>
</LayoutBN> </LayoutBN>
<script is:inline> <script is:inline>

View File

@ -15,37 +15,37 @@ const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===
const items = data.data[idx]; const items = data.data[idx];
// console.log(data.data[idx]) // console.log(data.data[idx])
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/bn/local/${items.slug}` tiwtterURL=`https://barta-india.in/bn/local/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/bn/local/${items.slug}` ogSiteName=`https://barta-india.in/bn/local/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/bn/local/${items.slug}` ogURL=`https://barta-india.in/bn/local/${items.slug}`
canonical=`https://barta-india.in/bn/local/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
<p class="text-xl font-bold text-[#780a0a]">Share on: </p> <p class="text-xl font-bold text-[#780a0a]">Share on: </p>
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/local/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a> <a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/local/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/local/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> <a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/local/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/local/${items.slug}&text=Your%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a> <a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/local/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/local/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> <a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/local/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div> </div>
</div> </div>
@ -54,6 +54,41 @@ const items = data.data[idx];
</section> </section>
</main> </main>
</LayoutBN> </LayoutBN>
<script is:inline>
let isListening = false;
let speechSynthesisInstance = window.speechSynthesis;
function toggleSpeech() {
if (isListening) {
stopSpeech();
} else {
startSpeech();
}
}
function startSpeech() {
let message1 = document.getElementById('message1').innerText;
let message2 = document.getElementById('message2').innerText;
let allSpeechText = message1 + ' ' + message2;
let speechText = new SpeechSynthesisUtterance(allSpeechText);
speechText.lang = 'bn'; // Set language to Bengali
speechSynthesisInstance.speak(speechText);
document.getElementById('listenButton').innerText = 'Stop';
isListening = true;
}
function stopSpeech() {
speechSynthesisInstance.cancel();
document.getElementById('listenButton').innerText = 'Listen';
isListening = false;
}
// if(window.location.reload()){
// isListening = false;
// }
</script>
<style> <style>
section > div > p > p { section > div > p > p {
text-align: justify; text-align: justify;

View File

@ -8,58 +8,74 @@ const metaJSON = await fetchMeta.json();
const items = metaJSON.data[0]; const items = metaJSON.data[0];
// const imageData = data.image; // const imageData = data.image;
// const data = fetchDataJSON.data; // const data = fetchDataJSON.data;
// console.log()
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.title}
metaTitle={items.title} metaTitle={items.title}
description={items.description} description={items.description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.title}
tiwtterDesc={items.description} tiwtterDesc={items.description}
tiwtterURL=`https://barta-india.in/bn/local/` tiwtterURL=`https://barta-india.in/bn/local/`
ogSiteName=`https://barta-india.in/bn/local/` ogSiteName=`https://barta-india.in/bn/local/`
ogType={items.og_type} ogType={items.og_type}
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in/bn/local/` ogURL=`https://barta-india.in/bn/local/`
canonical=`https://barta-india.in/bn/local` >
>
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<div class="my-16"> <div class="my-16">
<span class="text-[#780a0a] font-bold" id="pageName"></span> <span class="text-[#780a0a] font-bold" id="pageName"></span>
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/bn/${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/bn/local/${items.slug}`}>
<img class="aspect-video " src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title}/> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<div class="h-[100px] overflow-y-hidden"> <h2 class="text-lg text-justify ">{items.title}</h2>
<p id="" set:html={items.content}></p> </a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/bn/local/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div> </div>
</div> </div>
<div class="flex justify-end"> <div class="flex flex-row place-content-between">
<a href={`/bn/local/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a> <button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
</div> <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/bn/local/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div>
</div> </div>
)} )}
</div> <!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
<!-- <div class="flex flex-col"> </div>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </section>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main> </main>
</LayoutBN> </LayoutBN>
<script is:inline> <script is:inline>

View File

@ -15,37 +15,37 @@ const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===
const items = data.data[idx]; const items = data.data[idx];
// console.log(data.data[idx]) // console.log(data.data[idx])
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/bn/national/${items.slug}` tiwtterURL=`https://barta-india.in/bn/national/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/bn/national/${items.slug}` ogSiteName=`https://barta-india.in/bn/national/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/bn/national/${items.slug}` ogURL=`https://barta-india.in/bn/national/${items.slug}`
canonical=`https://barta-india.in/bn/local/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
<p class="text-xl font-bold text-[#780a0a]">Share on: </p> <p class="text-xl font-bold text-[#780a0a]">Share on: </p>
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/national/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a> <a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/national/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/national/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> <a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/national/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/national/${items.slug}&text=Your%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a> <a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/national/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/national/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> <a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/national/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div> </div>
</div> </div>
@ -54,6 +54,41 @@ const items = data.data[idx];
</section> </section>
</main> </main>
</LayoutBN> </LayoutBN>
<script is:inline>
let isListening = false;
let speechSynthesisInstance = window.speechSynthesis;
function toggleSpeech() {
if (isListening) {
stopSpeech();
} else {
startSpeech();
}
}
function startSpeech() {
let message1 = document.getElementById('message1').innerText;
let message2 = document.getElementById('message2').innerText;
let allSpeechText = message1 + ' ' + message2;
let speechText = new SpeechSynthesisUtterance(allSpeechText);
speechText.lang = 'bn'; // Set language to Bengali
speechSynthesisInstance.speak(speechText);
document.getElementById('listenButton').innerText = 'Stop';
isListening = true;
}
function stopSpeech() {
speechSynthesisInstance.cancel();
document.getElementById('listenButton').innerText = 'Listen';
isListening = false;
}
// if(window.location.reload()){
// isListening = false;
// }
</script>
<style> <style>
section > div > p > p { section > div > p > p {
text-align: justify; text-align: justify;

View File

@ -11,54 +11,71 @@ const items = metaJSON.data[0];
// console.log() // console.log()
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.title}
metaTitle={items.title} metaTitle={items.title}
description={items.description} description={items.description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.title}
tiwtterDesc={items.description} tiwtterDesc={items.description}
tiwtterURL=`https://barta-india.in/bn/national/` tiwtterURL=`https://barta-india.in/bn/national/`
ogSiteName=`https://barta-india.in/bn/national/` ogSiteName=`https://barta-india.in/bn/national/`
ogType={items.og_type} ogType={items.og_type}
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in/bn/national/` ogURL=`https://barta-india.in/bn/national/`
canonical=`https://barta-india.in/bn/national` >
>
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<div class="my-16"> <div class="my-16">
<span class="text-[#780a0a] font-bold" id="pageName"></span> <span class="text-[#780a0a] font-bold" id="pageName"></span>
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/bn/national/${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/bn/national/${items.slug}`}>
<img class="aspect-video" src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title}/> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<div class="h-[100px] overflow-y-hidden"> <h2 class="text-lg text-justify ">{items.title}</h2>
<p id="" set:html={items.content}></p> </a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/bn/national/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div> </div>
</div> </div>
<div class="flex justify-end"> <div class="flex flex-row place-content-between">
<a href={`/bn/national/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a> <button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
</div> <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/bn/national/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div>
</div> </div>
)} )}
</div> <!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
<!-- <div class="flex flex-col"> </div>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </section>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main> </main>
</LayoutBN> </LayoutBN>
<script is:inline> <script is:inline>

View File

@ -15,37 +15,37 @@ const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===
const items = data.data[idx]; const items = data.data[idx];
// console.log(data.data[idx]) // console.log(data.data[idx])
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/bn/politics/${items.slug}` tiwtterURL=`https://barta-india.in/bn/politics/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/bn/politics/${items.slug}` ogSiteName=`https://barta-india.in/bn/politics/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/bn/politics/${items.slug}` ogURL=`https://barta-india.in/bn/politics/${items.slug}`
canonical=`https://barta-india.in/bn/politics/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
<p class="text-xl font-bold text-[#780a0a]">Share on: </p> <p class="text-xl font-bold text-[#780a0a]">Share on: </p>
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/politics/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a> <a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/politics/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/politics/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> <a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/politics/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/politics/${items.slug}&text=Your%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a> <a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/politics/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/politics/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> <a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/politics/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div> </div>
</div> </div>
@ -54,6 +54,41 @@ const items = data.data[idx];
</section> </section>
</main> </main>
</LayoutBN> </LayoutBN>
<script is:inline>
let isListening = false;
let speechSynthesisInstance = window.speechSynthesis;
function toggleSpeech() {
if (isListening) {
stopSpeech();
} else {
startSpeech();
}
}
function startSpeech() {
let message1 = document.getElementById('message1').innerText;
let message2 = document.getElementById('message2').innerText;
let allSpeechText = message1 + ' ' + message2;
let speechText = new SpeechSynthesisUtterance(allSpeechText);
speechText.lang = 'bn'; // Set language to Bengali
speechSynthesisInstance.speak(speechText);
document.getElementById('listenButton').innerText = 'Stop';
isListening = true;
}
function stopSpeech() {
speechSynthesisInstance.cancel();
document.getElementById('listenButton').innerText = 'Listen';
isListening = false;
}
// if(window.location.reload()){
// isListening = false;
// }
</script>
<style> <style>
/* section > div > p > p { /* section > div > p > p {
text-align: justify; text-align: justify;

View File

@ -12,54 +12,71 @@ const items = metaJSON.data[0];
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.title}
metaTitle={items.title} metaTitle={items.title}
description={items.description} description={items.description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.title}
tiwtterDesc={items.description} tiwtterDesc={items.description}
tiwtterURL=`https://barta-india.in/bn/politics/` tiwtterURL=`https://barta-india.in/bn/politics/`
ogSiteName=`https://barta-india.in/bn/politics/` ogSiteName=`https://barta-india.in/bn/politics/`
ogType={items.og_type} ogType={items.og_type}
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in/bn/politics/` ogURL=`https://barta-india.in/bn/politics/`
canonical=`https://barta-india.in/bn/politics` >
>
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<div class="my-16"> <div class="my-16">
<span class="text-[#780a0a] font-bold" id="pageName"></span> <span class="text-[#780a0a] font-bold" id="pageName"></span>
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/bn/politics/${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/bn/politics/${items.slug}`}>
<img class="aspect-video " src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title}/> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<div class="h-[100px] overflow-y-hidden"> <h2 class="text-lg text-justify ">{items.title}</h2>
<p id="" set:html={items.content}></p> </a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/bn/politics/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div> </div>
</div> </div>
<div class="flex justify-end"> <div class="flex flex-row place-content-between">
<a href={`/bn/politics/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a> <button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
</div> <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/bn/politics/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div>
</div> </div>
)} )}
</div> <!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
<!-- <div class="flex flex-col"> </div>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </section>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main> </main>
</LayoutBN> </LayoutBN>
<script is:inline> <script is:inline>

View File

@ -15,37 +15,37 @@ const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===
const items = data.data[idx]; const items = data.data[idx];
// console.log(data.data[idx]) // console.log(data.data[idx])
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/bn/technology/${items.slug}` tiwtterURL=`https://barta-india.in/bn/technology/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/bn/technology/${items.slug}` ogSiteName=`https://barta-india.in/bn/technology/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/bn/technology/${items.slug}` ogURL=`https://barta-india.in/bn/technology/${items.slug}`
canonical=`https://barta-india.in/bn/politics/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
<p class="text-xl font-bold text-[#780a0a]">Share on: </p> <p class="text-xl font-bold text-[#780a0a]">Share on: </p>
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/technology/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a> <a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/technology/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/technology/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> <a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/technology/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/technology/${items.slug}&text=Your%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a> <a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/technology/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/technology/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> <a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/technology/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div> </div>
</div> </div>

View File

@ -12,54 +12,71 @@ const items = metaJSON.data[0];
--- ---
<LayoutBN title={items.title} <LayoutBN title={items.title}
metaTitle={items.title} metaTitle={items.title}
description={items.description} description={items.description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.title}
tiwtterDesc={items.description} tiwtterDesc={items.description}
tiwtterURL=`https://barta-india.in/bn/technology/` tiwtterURL=`https://barta-india.in/bn/technology/`
ogSiteName=`https://barta-india.in/bn/technology/` ogSiteName=`https://barta-india.in/bn/technology/`
ogType={items.og_type} ogType={items.og_type}
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in/bn/technology/` ogURL=`https://barta-india.in/bn/technology/`
canonical=`https://barta-india.in/bn/technology` >
>
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<div class="my-16"> <div class="my-16">
<span class="text-[#780a0a] font-bold" id="pageName"></span> <span class="text-[#780a0a] font-bold" id="pageName"></span>
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/bn/technology/${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/bn/technology/${items.slug}`}>
<img class="aspect-video" src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} /> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<div class="h-[100px] overflow-y-hidden"> <h2 class="text-lg text-justify ">{items.title}</h2>
<p id="" set:html={items.content}></p> </a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/bn/technology/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div> </div>
</div> </div>
<div class="flex justify-end"> <div class="flex flex-row place-content-between">
<a href={`/bn/technology/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a> <button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
</div> <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/bn/technology/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div>
</div> </div>
)} )}
</div> <!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
<!-- <div class="flex flex-col"> </div>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </section>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main> </main>
</LayoutBN> </LayoutBN>
<script is:inline> <script is:inline>

View File

@ -83,7 +83,7 @@ import Layout from "../layouts/Layout.astro";
// } // }
// }) // })
console.log("Form Data",formData, username, userPhone, userEmail, userMsg) // console.log("Form Data",formData, username, userPhone, userEmail, userMsg)
const url = 'https://api7.siliconpin.com/items/barta_contact'; const url = 'https://api7.siliconpin.com/items/barta_contact';
try { try {
@ -95,10 +95,10 @@ import Layout from "../layouts/Layout.astro";
body:JSON.stringify(formData), body:JSON.stringify(formData),
}); });
if (response.ok) { if (response.ok) {
console.log('Form Submitted') // console.log('Form Submitted')
formSection.style.display = 'none'; formSection.style.display = 'none';
thankYouSection.style.display = 'block'; thankYouSection.style.display = 'block';
console.log('Form data submitted successfully', response); // console.log('Form data submitted successfully', response);
} else { } else {
console.error('Failed to submit form data'); console.error('Failed to submit form data');
} }

View File

@ -0,0 +1,57 @@
---
import Layout from "../../layouts/Layout.astro";
---
<Layout title="Upload File | Barta-India">
<main>
<div class="container mx-auto px-4 flex flex-col space-y-4">
<h1>Upload File</h1>
<form action="https://apisp.dev2.cicdhosting.com/news/add-file/" method="post" enctype="multipart/form-data">
<label for="file">Choose a file:</label>
<input type="file" name="file" id="file" required>
<br>
<input type="submit" value="Upload">
</form>
</div>
</main>
</Layout>
<script is:inline>
// function uploadFile() {
// var fileInput = document.getElementById('fileInput');
// var file = fileInput.files[0];
// if (file) {
// var formData = new FormData();
// formData.append('fileInput', file);
// fetch('https://apisp.dev2.cicdhosting.com/news/add-file/?action=save', {
// method: 'POST',
// body: formData
// })
// .then(response => response.json())
// .then(data => {
// document.getElementById('status').innerText = data.message;
// })
// .catch(error => {
// console.error('Error:', error);
// });
// } else {
// document.getElementById('status').innerText = 'Please select a file.';
// }
// }
// function fileUpload(){
// let formData = new FormData(document.getElementById('uploadForm'));
// fetch(`https://apisp.dev2.cicdhosting.com/news/add-file/?action=save`, {
// method: 'POST',
// body: formData
// })
// .then(response => response.json())
// .then(data => {
// console.log(data);
// })
// .catch(error => {
// console.log('An error occurred', error);
// });
// }
</script>

View File

@ -0,0 +1,267 @@
---
import Layout from "../../layouts/Layout.astro";
// import ImageUpload from "../../components/ImageUpload.vue";
---
<Layout title="Add News | Barta India">
<main>
<div>
<section class="container mx-auto px-4 md:max-w-3xl mt-40 space-y-4 shadow-xl rounded-xl p-4">
<h1 class="text-center text-2xl underline decoration-4 decoration-[#580a0a]">Genarate New News</h1>
<form id="newsPara" class="flex flex-col space-y-4" enctype="multipart/form-data">
<label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
<select required onchange="qryWithLang();" name="language" id="language" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
<option value="0">-Select-</option>
<option value="english">English</option>
<option value="bengali">Bengali</option>
</select>
<div class="flex flex-col">
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
<option value="0">-Select-</option>
<option value="national">National</option>
<option value="politics">Politics</option>
<option value="local">Local</option>
<option value="technology">Technology</option>
<option value="world">World</option>
</select>
</div>
<div class="flex flex-col ">
<label for="preText">News Paragraph</label>
<textarea onchange="buttonVisibility();" required name="preText" id="preText" cols="30" maxlength="1000000" rows="10" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"></textarea>
</div>
<div class="flex flex-col">
<textarea required name="systemMessage" id="systemMessage" cols="30" rows="3" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"></textarea>
</div>
<div>
<button id="genButton" style="display: none;" onclick="submitNewsPara(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg" >Genarate</button>
<button id="genButton2" style="display: block;" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg opacity-50 cursor-not-allowed" >Genarate</button>
</div>
<!-- <input id="message" type="text" value="" class="border-2 border-[#580a0a] p-2 focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"/> -->
</form>
</section>
<section id="formSection" style="display: none;" class="container mx-auto md:max-w-3xl px-4 shadow-xl rounded-xl p-6">
<div class="flex justify-center">
<h1 class="text-xl my-6 p-2 border-2 bg-[#580a0a] text-white rounded-full">Add News to Barta-India's Page</h1>
</div>
<p>All(<span class="text-[#580a0a] font-bold">*</span>) are mandatory fields</p>
<form id="newsForm" class="flex flex-col space-y-4">
<div class="flex flex-col">
<label for="status">Status<span class="text-[#580a0a] font-bold">*</span></label>
<select name="status" id="status" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" required>
<option value="null">-Select-</option>
<option value="published">Published</option>
<option value="draft">Draft</option>
<option value="archived">Archived</option>
</select>
</div>
<div class="flex flex-col">
<label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
<select name="language" id="language" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" required>
<option value="null">-Select-</option>
<option value="bengali">Bengali</option>
<option value="english">English</option>
</select>
</div>
<div class="flex flex-col">
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
<option value="null">-Select-</option>
<option value="national">National</option>
<option value="politics">Politics</option>
<option value="local">Local</option>
<option value="technology">Technology</option>
<option value="world">World</option>
</select>
</div>
<div class="flex flex-col">
<label for="title">Title<span class="text-[#580a0a] font-bold">*</span></label>
<input name="title" id="title" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
</div>
<div class="flex flex-col">
<label for="slug">Slug<span class="text-[#580a0a] font-bold">*</span></label>
<input oninput="updateSlug();" name="slug" id="slug" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
</div>
<div class="flex flex-col">
<label for="heading">Heading<span class="text-[#580a0a] font-bold">*</span></label>
<input name="heading" id="heading" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
</div>
<div class="flex flex-col">
<label for="meta_title">Meta Title<span class="text-[#580a0a] font-bold">*</span></label>
<input name="meta_title" id="meta_title" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 60 characters & try to use common words" required>
</div>
<div class="flex flex-col">
<label for="meta_description">Meta Description<span class="text-[#580a0a] font-bold">*</span></label>
<input name="meta_description" id="meta_description" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 160 characters & try to use common words" required>
</div>
<div class="flex flex-col">
<label for="in_brief">In Brief<span class="text-[#580a0a] font-bold">*</span></label>
<input name="in_brief" id="in_brief" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 280 characters & try to descibe" required>
</div>
<div class="flex flex-col">
<label class="text-lg" for="content">News Description<span class="text-[#580a0a] font-bold">*</span></label>
<textarea class="border-2 p-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" name="content" id="content" cols="30" rows="10" required></textarea>
</div>
<div class="flex flex-col">
<label for="upldFile">Upload File</label>
<input id="upldFile" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" type="file">
</div>
<div class="flex float-right">
<button onclick="callApi(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">Save</button>
</div>
</form>
</section>
<section class="bg-white rounded-full px-6 py-4" id="loadingSection" style="display: none;">
<div class="flex flex-col justify-center place-items-center">
<div class="load-aimate animate-spin "></div>
<p>Processing...</p>
</div>
</section>
<!-- <section class="container mx-auto">
<div>
<dialog id="d" class="w-[50%]">
<form method="dialog">
<p>Modal Content Modal Content Lorem ipsum dolor sit, amet consectetur adipisicing elit. Hic consequatur aspernatur, explicabo sequi perspiciatis quisquam voluptates tenetur placeat numquam consectetur! Tempore expedita facilis tempora labore at illo beatae eligendi magnam.</p>
<button>ok</button>
</form>
</dialog>
<button onclick="d.showModal()">Open</button>
</div>
</section> -->
</div>
</main>
</Layout>
<script is:inline>
function qryWithLang(){
let langValue = document.getElementById('language').value;
document.getElementById('systemMessage').value = `need title, heading not more than 160 characters, meta_title not more than 60 characters, meta_description not more than 160 characters, short_description not more than 280 characters, long_description below 2000 characters, all are ${langValue} language all in a json structure`;
// give me long description below 2000 characters, title, heading not more than 160 characters, short desciption not more than 280 characters, meta_title not more than 60 characters and try to use common words, meta_description not more than 160 characters and try to use common words, all text are convert to ${langValue} language, give me all in a json structure`
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
}
function buttonVisibility() {
var preTextValue = document.getElementById('preText').value.trim();
var systemMessageValue = document.getElementById('systemMessage').value.trim();
var languageValue = document.getElementById('language').value;
var categoryValue = document.getElementById('category').value;
var genButton = document.getElementById('genButton');
var genButton2 = document.getElementById('genButton2');
if (preTextValue.length > 0 && systemMessageValue.length > 0 && languageValue !== null) {
genButton.style.display = 'block';
genButton2.style.display = 'none';
} else {
genButton.style.display = 'none';
genButton2.style.display = 'block';
}
}
function submitNewsPara(event) {
event.preventDefault();
let genButton = document.getElementById('genButton');
let langInput = document.getElementById('language');
let loadSection = document.getElementById('loadingSection');
let newsData = document.getElementById('newsPara');
loadSection.style.display = 'block';
genButton.disabled = true;
langInput.disabled = true;
genButton.style.cursor = 'not-allowed';
let formData = new FormData(newsData);
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/`, {
method: 'POST',
body: formData,
})
.then(data => data.json())
.then(data => {
// if (data === 200) {
// counter++;
// } else {
// formSection genButton brightness-50
console.log(data)
// }
let newsData = data.choices[0].message.content;
if(newsData){
document.getElementById('formSection').style.display = 'block';
loadSection.style.display = 'none';
genButton.disabled = false;
genButton.style.cursor = 'pointer';
langInput.disabled = false;
// document.getElementById('loadingSection').classList.remove = 'brightness-50';
// document.getElementById('genButton').classList.remove = 'disabled';
}
let jsonObject = JSON.parse(newsData);
document.getElementById('title').value = jsonObject.title;
document.getElementById('slug').value = jsonObject.title;
document.getElementById('heading').value = jsonObject.heading;
document.getElementById('meta_title').value = jsonObject.meta_title;
document.getElementById('meta_description').value = jsonObject.meta_description;
document.getElementById('in_brief').value = jsonObject.short_description;
document.getElementById('content').value = jsonObject.long_description;
if(jsonObject.long_description){
// document.getElementById('content').value = jsonObject.long_description;
}
})
.catch(error => {
console.error('Error occurred', error);
});
}
function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w-]+/g, '') // Remove all non-word characters
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
function updateSlug() {
const titleInput = document.getElementById('slug');
const slugInput = document.getElementById('slug');
const titleValue = titleInput.value;
slugInput.value = slugify(titleValue);
}
function callApi(event) {
event.preventDefault();
let slugValue = document.getElementById('slug').value;
let newsData = document.getElementById('newsForm');
let formData = new FormData(newsData);
fetch(`https://apisp.dev2.cicdhosting.com/news/add-news/?action=save`, {
method: 'POST',
body: formData,
})
.then(data => data.json())
.then(data => {
if (data.success === true) {
window.location.href= `/add-file?slug=${slugValue}`
// console.log(slugValue)
console.log('Form Data Submitted Successfully');
} else {
console.log('Data Submit Failed');
}
console.log(data);
})
.catch(error => {
console.error('Error occurred', error);
});
}
</script>
<style>
#loadingSection{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.load-aimate{
width: 60px;
height: 60px;
border-radius: 50%;
border-left: 5px solid #580a0a;
border-right: 5px solid #580a0a;
border-bottom: 5px solid #580a0a;
border-top: 5px solid #FFFFFF;
background-color: #FFFFFF;
}
</style>

View File

@ -0,0 +1,58 @@
---
import Layout from "../../layouts/Layout.astro";
---
<Layout title="Edit News | Barta-India">
<main>
<div>
<section class="container mx-auto px-4">
<div class="flex flex-col">
<p class="text-2xl">Edit News</p>
<select name="lang" id="lang">Select Language
<option value="en">English</option>
<option value="bn">Bengali</option>
<option value="hi">Hindi</option>
<option value="zh">Mandarine</option>
<option value="se">Spanish</option>
</select>
<table class="border-2">
<thead>
<tr class="text-center">
<th>ID</th>
<th>Status</th>
<th>Edit</th>
</tr>
</thead>
<tbody class="text-center border-2" id="statusTableBody"></tbody>
</table>
</div>
</section>
</div>
</main>
</Layout>
<script is:inline>
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/edit-news-list/`)
.then(response => response.json())
.then(data => {
console.log(data);
let tableBody = document.getElementById('statusTableBody');
data.forEach(function(singleData) {
let row = tableBody.insertRow();
let cellId = row.insertCell(0);
cellId.innerHTML = singleData.id;
let cellStatus = row.insertCell(1);
cellStatus.innerHTML = singleData.status;
let cellEdit = row.insertCell(2);
let editButton = document.createElement('a');
editButton.innerText = 'Edit';
editButton.href = `/editor/?edit=${singleData.slug}&lang=${document.getElementById('lang').value}`
editButton.addEventListener('click', function() {
// Add your edit functionality here
// console.log('Editing ID:', singleData.id);
});
cellEdit.appendChild(editButton);
});
})
.catch(error => console.error('Error fetching data:', error));
</script>

View File

@ -0,0 +1,77 @@
---
import Layout from "../../layouts/Layout.astro";
---
<Layout title="">
<main>
<div>
<section class="container mx-auto px-4 md:max-w-3xl mt-40 space-y-4 shadow-xl rounded-xl p-4">
<h1 class="text-center text-2xl underline decoration-4 decoration-[#580a0a]">Genarate New News</h1>
<form id="newsPara" class="flex flex-col space-y-4" enctype="multipart/form-data">
<label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
<select name="language" id="language" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
<option value="null">-Select-</option>
<option value="English">English</option>
<option value="Bengali">Bengali</option>
</select>
<div class="flex flex-col">
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
<option value="null">-Select-</option>
<option value="national">National</option>
<option value="politics">Politics</option>
<option value="local">Local</option>
<option value="technology">Technology</option>
<option value="world">World</option>
</select>
</div>
<div class="flex flex-col ">
<label for="content">Nes Paragraph</label>
<textarea name="content" id="content" cols="30" maxlength="1000000" rows="10" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"></textarea>
</div>
<div>
<button onclick="submitNewsPara(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg" >Genarate</button>
<h1 id="message"></h1>
</div>
<!-- <input id="message" type="text" value="" class="border-2 border-[#580a0a] p-2 focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"/> -->
</form>
</section>
</div>
</main>
</Layout>
<script is:inline>
function submitNewsPara(event) {
event.preventDefault();
let newsData = document.getElementById('newsPara');
let formData = new FormData(newsData);
// formData.append('content', document.getElementById('content').value);
// console.log('FormData entries:');
// for (const entry of formData.entries()) {
// console.log(typeof entry[0], entry[0]);
// }
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/`, {
method: 'POST',
body: formData,
})
.then(data => data.json())
.then(data => {
// if (data === 200) {
// counter++;
// } else {
console.log(data)
// }
let newsData = data.choices[0].message.content;
const jsonObject = JSON.parse(newsData);
document.getElementById('message').innerHTML = jsonObject.title + "<br> Description: " + jsonObject.description; //jsonObject;
// document.getElementById('message').value = jsonObject.title;
// console.log(newsData);
// return data.choices[0].message.content;
})
.catch(error => {
console.error('Error occurred', error);
});
}
</script>

View File

@ -0,0 +1,21 @@
---
import Layout from "../../layouts/Layout.astro";
import EditNews from "../../components/EditNews.vue";
---
<Layout title="Edit News | Barta-India">
<main>
<div>
<EditNews client:visible />
</div>
</main>
<!-- </Layout>
<script is:inline>
let pramsURL = document.location.href.split('/')[3].split('edit=')[1];
document.getElementById('url').innerHTML = pramsURL;
// console.log(pramsURL)
function getNewsData(){
}
</script> -->

View File

@ -0,0 +1,158 @@
---
import Layout from "../../layouts/Layout.astro";
import ImageUpload from "../../components/ImageUpload.vue";
---
<Layout title="Add News | Barta India">
<main>
<div>
<section class="container mx-auto px-4 md:max-w-3xl mt-40 space-y-4 shadow-xl rounded-xl p-4">
<h1 class="text-center text-2xl underline decoration-4 decoration-[#580a0a]">Genarate New News</h1>
<form id="newsPara" class="flex flex-col space-y-4" enctype="multipart/form-data">
<!-- <label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
<select required onchange="qryWithLang();" name="language" id="language" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
<option value="0">-Select-</option>
<option value="english">English</option>
<option value="bengali">Bengali</option>
</select> -->
<div class="flex flex-col">
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
<option value="0">-Select-</option>
<option value="national">National</option>
<option value="politics">Politics</option>
<option value="local">Local</option>
<option value="technology">Technology</option>
<option value="world">World</option>
</select>
</div>
<div class="flex flex-col ">
<label for="preText">News Paragraph</label>
<textarea required name="preText" id="preText" cols="30" maxlength="1000000" rows="10" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl">white tiger</textarea>
</div>
<div class="flex flex-col">
<textarea required name="systemMessage" id="systemMessage" cols="30" rows="3" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl">provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters, heading within 170 characters in en, bn, hi, zh, es ar all in a json structure no use comma after line ending</textarea>
</div>
<div>
<button id="genButton" onclick="submitNewsPara(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg" >Genarate</button>
</div>
<!-- <input id="message" type="text" value="" class="border-2 border-[#580a0a] p-2 focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"/> -->
</form>
</section>
</div>
</main>
</Layout>
<script is:inline>
function qryWithLang(){
let langValue = document.getElementById('language').value;
document.getElementById('systemMessage').value = `provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters, heading within 170 characters in en, bn, hi, zh, es, pt, ru, fr, ur, ar all in a json structure no use comma after line ending`;
// give me long description below 2000 characters, title, heading not more than 160 characters, short desciption not more than 280 characters, meta_title not more than 60 characters and try to use common words, meta_description not more than 160 characters and try to use common words, all text are convert to ${langValue} language, give me all in a json structure`
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
// need title, heading not more than 160 characters, meta_title not more than 60 characters, meta_description not more than 160 characters, short_description not more than 280 characters, long_description below 2000 characters, all are ${langValue} language all in a json structure
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali, hindi, Mandarin, Spanish, Portuguese, Russian, French, all in a json structure
}
function submitNewsPara(event) {
event.preventDefault();
let genButton = document.getElementById('genButton');
let langInput = document.getElementById('language');
let loadSection = document.getElementById('loadingSection');
let newsData = document.getElementById('newsPara');
let formData = new FormData(newsData);
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/multi-lang/`, {
method: 'POST',
body: formData,
})
.then(data => data.json())
.then(data => {
// if (data === 200) {
// counter++;
// } else {
// formSection genButton brightness-50
console.log(data)
// }
let newsData = data.choices[0].message.content;
let jsonObject = JSON.parse(newsData);
// Sample array
// Using forEach to log each element
// jsonObject.forEach(function(arrayData) {
// console.log('Array Data', arrayData);
// });
// console.log(jsonObject.en)
// console.log(jsonObject.bn)
// document.getElementById('title').value = jsonObject.title;
// document.getElementById('slug').value = jsonObject.title;
// document.getElementById('heading').value = jsonObject.heading;
// document.getElementById('meta_title').value = jsonObject.meta_title;
// document.getElementById('meta_description').value = jsonObject.meta_description;
// document.getElementById('in_brief').value = jsonObject.short_description;
// document.getElementById('content').value = jsonObject.long_description;
})
.catch(error => {
console.error('Error occurred', error);
});
}
function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w-]+/g, '') // Remove all non-word characters
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
function updateSlug() {
const titleInput = document.getElementById('slug');
const slugInput = document.getElementById('slug');
const titleValue = titleInput.value;
slugInput.value = slugify(titleValue);
}
function callApi(event) {
event.preventDefault();
let slugValue = document.getElementById('slug').value;
let newsData = document.getElementById('newsForm');
let formData = new FormData(newsData);
fetch(`https://apisp.dev2.cicdhosting.com/news/add-news/?action=save`, {
method: 'POST',
body: formData,
})
.then(data => data.json())
.then(data => {
if (data.success === true) {
window.location.href= `/add-file?slug=${slugValue}`
// console.log(slugValue)
console.log('Form Data Submitted Successfully');
} else {
console.log('Data Submit Failed');
}
console.log(data);
})
.catch(error => {
console.error('Error occurred', error);
});
}
</script>
<style>
#loadingSection{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.load-aimate{
width: 60px;
height: 60px;
border-radius: 50%;
border-left: 5px solid #580a0a;
border-right: 5px solid #580a0a;
border-bottom: 5px solid #580a0a;
border-top: 5px solid #FFFFFF;
background-color: #FFFFFF;
}
</style>

11
src/pages/hash.astro Normal file
View File

@ -0,0 +1,11 @@
---
import Layout from "../layouts/Layout.astro";
import HashRouting from "../components/HashRouting.vue";
---
<Layout title="Hash Routing">
<main>
<div>
<HashRouting client:visible />
</div>
</main>
</Layout>

11
src/pages/image.astro Normal file
View File

@ -0,0 +1,11 @@
---
import Layout from "../layouts/Layout.astro";
import ImageUpload from "../components/ImageUpload.vue";
---
<Layout title="">
<main>
<div class="container mx-auto px-4 mt-40">
<ImageUpload client:visible />
</div>
</main>
</Layout>

View File

@ -6,7 +6,7 @@ const data = dataJSON.data;
const fetchMeta = await fetch('https://api7.siliconpin.com/items/meta_data?filter[status][_eq]=published&filter[domain][_eq]=barta&filter[pages][_eq]=home_en'); const fetchMeta = await fetch('https://api7.siliconpin.com/items/meta_data?filter[status][_eq]=published&filter[domain][_eq]=barta&filter[pages][_eq]=home_en');
const metaJSON = await fetchMeta.json(); const metaJSON = await fetchMeta.json();
const items = metaJSON.data[0]; const items = metaJSON.data[0];
// console.log(items.img) // console.log(items.title)
// const imageData = data.image; // const imageData = data.image;
// const data = fetchDataJSON.data; // const data = fetchDataJSON.data;
// console.log() https://api7.siliconpin.com/items/meta_data?filter[status][_eq]=published&filter[domain][_eq]=barta&filter[pages][_eq]=home_en // console.log() https://api7.siliconpin.com/items/meta_data?filter[status][_eq]=published&filter[domain][_eq]=barta&filter[pages][_eq]=home_en
@ -26,38 +26,55 @@ const items = metaJSON.data[0];
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in` ogURL=`https://barta-india.in`
canonical=`https://barta-india.in`
> >
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A] my-16">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A] my-16">Latest News</h1>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/${items.slug}`}>
<img class="aspect-video " src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} /> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<div class="h-[100px] overflow-y-hidden"> <h2 class="text-lg text-justify">{items.title}</h2>
<p id="" set:html={items.content}></p> </a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div> </div>
</div> </div>
<div class="flex justify-end"> <div class="flex flex-row place-content-between">
<a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a> <button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
</div> <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div>
</div> </div>
)} )}
</div> <!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
<!-- <div class="flex flex-col"> </div>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </section>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main> </main>
</Layout> </Layout>
<script is:inline> <script is:inline>

View File

@ -15,37 +15,37 @@ const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===
const items = data.data[idx]; const items = data.data[idx];
// console.log(data.data[idx]) // console.log(data.data[idx])
--- ---
<Layout title={items.title} <Layout title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/local/${items.slug}` tiwtterURL=`https://barta-india.in/local/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/local/${items.slug}` ogSiteName=`https://barta-india.in/local/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/local/${items.slug}` ogURL=`https://barta-india.in/local/${items.slug}`
canonical=`https://barta-india.in/local/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
<p class="text-xl font-bold text-[#780a0a]">Share on: </p> <p class="text-xl font-bold text-[#780a0a]">Share on: </p>
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/local/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a> <a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/local/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/local/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> <a href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2Flocal%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a href=`http://www.twitter.com/share?url=https://barta-india.in/local/${items.slug}&text=Your%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a> <a href=`http://www.twitter.com/share?url=https://barta-india.in/local/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/local/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> <a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/local/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div> </div>
</div> </div>
@ -54,6 +54,35 @@ const items = data.data[idx];
</section> </section>
</main> </main>
</Layout> </Layout>
<script is:inline>
let isListening = false;
let speechSynthesisInstance = window.speechSynthesis;
function toggleSpeech() {
if (isListening) {
stopSpeech();
} else {
startSpeech();
}
}
function startSpeech() {
let message1 = document.getElementById('message1').innerText;
let message2 = document.getElementById('message2').innerText;
let allSpeechText = message1 + ' ' + message2;
let speechText = new SpeechSynthesisUtterance(allSpeechText);
speechSynthesisInstance.speak(speechText);
document.getElementById('listenButton').innerText = 'Stop';
isListening = true;
}
function stopSpeech() {
speechSynthesisInstance.cancel();
document.getElementById('listenButton').innerText = 'Listen';
isListening = false;
}
</script>
<style> <style>
section > div > p > p { section > div > p > p {
text-align: justify; text-align: justify;

View File

@ -25,42 +25,60 @@ const items = metaJSON.data[0];
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in/local/` ogURL=`https://barta-india.in/local/`
canonical=`https://barta-india.in/local`
> >
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<div class="my-16"> <div class="my-16">
<span class="text-[#780a0a] font-bold" id="pageName"></span> <span class="text-[#780a0a] font-bold" id="pageName"></span>
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/local${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/local/${items.slug}`}>
<img class="aspect-video " src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} /> <a class="flex flex-col" href={`/${items.slug}`}>
<div class="h-[100px] overflow-y-hidden"> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<p id="" set:html={items.content}></p> <h2 class="text-lg text-justify">{items.title}</h2>
</a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/local/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div>
</div>
<div class="flex flex-row place-content-between">
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
<p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/local/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div> </div>
</div> </div>
<div class="flex justify-end">
<a href={`/local/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a>
</div>
</div>
)} )}
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
</div> </div>
<!-- <div class="flex flex-col"> </section>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </main>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main>
</Layout> </Layout>
<script is:inline> <script is:inline>
const pageName = window.location.href.split('/')[3]; const pageName = window.location.href.split('/')[3];

133
src/pages/login.astro Normal file
View File

@ -0,0 +1,133 @@
---
import Layout from "../layouts/Layout.astro";
---
<Layout title="Login | Barta India">
<main>
<section class="">
<div class="flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen lg:py-0">
<a href="/" class="flex flex-col items-center mb-6 text-2xl font-semibold">
<img class="w-16 h-16 mr-2" src="/img/barta_logo.png" alt="logo">
Barta-India
</a>
<div class="w-full bg-[#4b556350] rounded-xl md:mt-0 sm:max-w-md xl:p-0 hover:shadow-2xl hover:shadow-[#86198f] duration-[2s]">
<div class="p-6 space-y-4 md:space-y-6 sm:p-8">
<h1 class="text-xl font-bold leading-tight tracking-tight md:text-2xl ">Sign in to your account</h1>
<form method="POST" id="loginForm" enctype="multipart/form-data" class="space-y-4 md:space-y-6">
<div>
<label for="siliconid" class="block mb-2 text-sm font-medium ">Siliconid</label>
<input type="text" name="siliconid" id="siliconid" class="bg-gray-50 border border-gray-300 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="example@email.com" required="">
</div>
<div>
<label for="password" class="block mb-2 text-sm font-medium ">Password</label>
<input type="password" name="password" id="password" placeholder="Enter Password" class="bg-gray-50 border border-gray-300 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500" required="">
</div>
<div class="flex items-center justify-between">
<div class="flex items-start">
<div class="flex items-center h-5">
<input id="remember" aria-describedby="remember" type="checkbox" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-primary-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-primary-600 dark:ring-offset-gray-800" >
</div>
<div class="ml-3 text-sm">
<label for="remember" class="text-gray-500 ">Remember me</label>
</div>
</div>
<a href="#" class="text-sm font-medium hover:underline">Forgot password?</a>
</div>
<button type="submit" class="w-full text-white bg-[#05b3a4] hover:bg-[#05b3a4] focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800">Sign in</button>
<p class="text-sm font-light">
Don't have an account yet? <a href="/sign-up" class="font-medium hover:underline">Sign up</a>
</p>
</form>
</div>
</div>
</div>
</section>
</main>
</Layout>
<script src="https://accounts.google.com/gsi/client" async></script>
<script>
function handleCredentialResponse(response) {
// console.log("Encoded JWT ID token: " + response.credential);
var credential = {
credential: response.credential
};
fetch(`https://apisp.dev2.cicdhosting.com/sign/v2/?action=withGoogle`, {
method: 'POST',
body: JSON.stringify(credential),
})
.then(response => {
// console.log(response)
if (!response.ok) {
throw new Error('Authentication failed');
}
return response.json();
})
.then(data => {
console.log(data);
const access_token = data.access_token;
const name = data.name;
const ssid = data.ssid;
const siliconid = data.siliconid;
// console.log(data)
document.cookie = `access_token=${access_token}; path=/`;
document.cookie = `name=${name}; path=/`;
document.cookie = `ssid=${ssid}; path=/`;
document.cookie = `siliconid=${siliconid}; path=/`;
// window.location.href = '/profile';
})
.catch(error => {
console.error('Sign-Up failed:', error)
// Handle authentication failure, e.g., show an error message
});
}
window.onload = function () {
google.accounts.id.initialize({
client_id: "795913470645-lt5d04g6jkq05htq5nl5uab3p1otci63.apps.googleusercontent.com",
callback: handleCredentialResponse
});
// google.accounts.id.renderButton(
// document.getElementById("buttonDiv"),
// { theme: "outline", size: "large" } // customization attributes
// );
google.accounts.id.prompt(); // also display the One Tap dialog
}
</script>
<script is:inline>
document.getElementById('loginForm').addEventListener('submit', function (event) {
event.preventDefault();
const password = document.getElementById('password').value;
const siliconid = document.getElementById('siliconid').value;
var loginData = {
siliconid: siliconid,
password: password
};
fetch(`https://apisp.dev2.cicdhosting.com/sign/v2/?action=login`, {
method: 'POST',
body: JSON.stringify(loginData),
})
.then(response => {
// console.log(response)
if (!response.ok) {
throw new Error('Authentication failed');
}
return response.json();
})
.then(data => {
console.log(data);
const access_token = data.access_token;
const name = data.name;
const ssid = data.ssid;
const siliconid = data.siliconid;
// console.log(data)
document.cookie = `access_token=${access_token}; path=/`;
document.cookie = `name=${name}; path=/`;
document.cookie = `ssid=${ssid}; path=/`;
document.cookie = `siliconid=${siliconid}; path=/`;
window.location.href = '/profile';
})
.catch(error => {
console.error('Sign-Up failed:', error)
// Handle authentication failure, e.g., show an error message
});
});
</script>

View File

@ -16,37 +16,37 @@ const items = data.data[idx];
// console.log(data.data[idx]) // console.log(data.data[idx])
--- ---
<Layout title={items.title} <Layout title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/national/${items.slug}` tiwtterURL=`https://barta-india.in/national/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/national/${items.slug}` ogSiteName=`https://barta-india.in/national/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/national/${items.slug}` ogURL=`https://barta-india.in/national/${items.slug}`
canonical=`https://barta-india.in/national/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
<p class="text-xl font-bold text-[#780a0a]">Share on: </p> <p class="text-xl font-bold text-[#780a0a]">Share on: </p>
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/national/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a> <a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/national/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/national/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> <a href=`https://www.facebook.com/share.php?u=https://barta-india.in/national/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a href=`http://www.twitter.com/share?url=https://barta-india.in/national/${items.slug}&text=Your%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a> <a href=`http://www.twitter.com/share?url=https://barta-india.in/national/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/national/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> <a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/national/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div> </div>
</div> </div>
@ -55,6 +55,35 @@ const items = data.data[idx];
</section> </section>
</main> </main>
</Layout> </Layout>
<script is:inline>
let isListening = false;
let speechSynthesisInstance = window.speechSynthesis;
function toggleSpeech() {
if (isListening) {
stopSpeech();
} else {
startSpeech();
}
}
function startSpeech() {
let message1 = document.getElementById('message1').innerText;
let message2 = document.getElementById('message2').innerText;
let allSpeechText = message1 + ' ' + message2;
let speechText = new SpeechSynthesisUtterance(allSpeechText);
speechSynthesisInstance.speak(speechText);
document.getElementById('listenButton').innerText = 'Stop';
isListening = true;
}
function stopSpeech() {
speechSynthesisInstance.cancel();
document.getElementById('listenButton').innerText = 'Listen';
isListening = false;
}
</script>
<style> <style>
section > div > p > p { section > div > p > p {
text-align: justify; text-align: justify;

View File

@ -25,42 +25,60 @@ const items = metaJSON.data[0];
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in/national/` ogURL=`https://barta-india.in/national/`
canonical=`https://barta-india.in/national`
> >
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<div class="my-16"> <div class="my-16">
<span class="text-[#780a0a] font-bold" id="pageName"></span> <span class="text-[#780a0a] font-bold" id="pageName"></span>
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/national${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/national/${items.slug}`}>
<img class="aspect-video " src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} /> <a class="flex flex-col" href={`/${items.slug}`}>
<div class="h-[100px] overflow-y-hidden"> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<p id="" set:html={items.content}></p> <h2 class="text-lg text-justify">{items.title}</h2>
</a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/national/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div>
</div>
<div class="flex flex-row place-content-between">
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
<p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/national/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div> </div>
</div> </div>
<div class="flex justify-end">
<a href={`/national/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a>
</div>
</div>
)} )}
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
</div> </div>
<!-- <div class="flex flex-col"> </section>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </main>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main>
</Layout> </Layout>
<script is:inline> <script is:inline>
const pageName = window.location.href.split('/')[3]; const pageName = window.location.href.split('/')[3];

View File

@ -15,38 +15,38 @@ const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===
const items = data.data[idx]; const items = data.data[idx];
// console.log(data.data[idx]) // console.log(data.data[idx])
--- ---
<Layout title={items.title} <Layout title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/politics/${items.slug}` tiwtterURL=`https://barta-india.in/politics/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/politics/${items.slug}` ogSiteName=`https://barta-india.in/politics/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/politics/${items.slug}` ogURL=`https://barta-india.in/politics/${items.slug}`
canonical=`https://barta-india.in/politics/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
<p class="text-xl font-bold text-[#780a0a]">Share on: </p> <p class="text-xl font-bold text-[#780a0a]">Share on: </p>
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/politics/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a> <a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/politics/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/politics/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a> <a href=`https://www.facebook.com/share.php?u=https://barta-india.in/politics/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a href=`http://www.twitter.com/share?url=https://barta-india.in/politics/${items.slug}&text=Your%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a> <a href=`http://www.twitter.com/share?url=https://barta-india.in/politics/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/politics/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> <a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/politics/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div> </div>
</div> </div>
@ -55,6 +55,35 @@ const items = data.data[idx];
</section> </section>
</main> </main>
</Layout> </Layout>
<script is:inline>
let isListening = false;
let speechSynthesisInstance = window.speechSynthesis;
function toggleSpeech() {
if (isListening) {
stopSpeech();
} else {
startSpeech();
}
}
function startSpeech() {
let message1 = document.getElementById('message1').innerText;
let message2 = document.getElementById('message2').innerText;
let allSpeechText = message1 + ' ' + message2;
let speechText = new SpeechSynthesisUtterance(allSpeechText);
speechSynthesisInstance.speak(speechText);
document.getElementById('listenButton').innerText = 'Stop';
isListening = true;
}
function stopSpeech() {
speechSynthesisInstance.cancel();
document.getElementById('listenButton').innerText = 'Listen';
isListening = false;
}
</script>
<style> <style>
/* section > div > p > p { /* section > div > p > p {
text-align: justify; text-align: justify;

View File

@ -25,42 +25,60 @@ const items = metaJSON.data[0];
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in/politics/` ogURL=`https://barta-india.in/politics/`
canonical=`https://barta-india.in/politics`
> >
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<div class="my-16"> <div class="my-16">
<span class="text-[#780a0a] font-bold" id="pageName"></span> <span class="text-[#780a0a] font-bold" id="pageName"></span>
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/politics${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/politics/${items.slug}`}>
<img class="aspect-video " src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} /> <a class="flex flex-col" href={`/${items.slug}`}>
<div class="h-[100px] overflow-y-hidden"> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<p id="" set:html={items.content}></p> <h2 class="text-lg text-justify">{items.title}</h2>
</a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/politics/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div>
</div>
<div class="flex flex-row place-content-between">
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
<p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/politics/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div> </div>
</div> </div>
<div class="flex justify-end">
<a href={`/politics/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a>
</div>
</div>
)} )}
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
</div> </div>
<!-- <div class="flex flex-col"> </section>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </main>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main>
</Layout> </Layout>
<script is:inline> <script is:inline>
const pageName = window.location.href.split('/')[3]; const pageName = window.location.href.split('/')[3];

View File

@ -2,7 +2,6 @@
import Layout from "../layouts/Layout.astro"; import Layout from "../layouts/Layout.astro";
--- ---
<Layout title="Privacy Policy | Barta-India" <Layout title="Privacy Policy | Barta-India"
canonical=`https://barta-india.in/privacy-policy`
> >
<main> <main>

View File

@ -0,0 +1,25 @@
---
import Layout from "../layouts/Layout.astro";
---
<Layout title="Text to Speech | Barta">
<main>
<div>
<section class="container mx-auto px-4 max-w-xl">
<div class="flex flex-col justify-center space-y-4">
<h1>Text to Speech</h1>
<label for="message"></label>
<textarea name="message" id="message" cols="30" rows="10" class="border-2 border-gray-400 focus:outline-none focus:border-[4px] focus:border-[#780a0a] rounded-2xl shadow-lg p-4"></textarea>
<button onclick="textSpeech();" class="bg-[#780a0a] px-6b py-2 rounded-lg text-white font-bold ">Speech</button>
<!-- <input name="message" id="message" type="text" class=""> -->
</div>
</section>
</div>
</main>
</Layout>
<script is:inline>
function textSpeech(){
let message = document.getElementById('message').value;
let speechText = new SpeechSynthesisUtterance(message);
window.speechSynthesis.speak(speechText);
}
</script>

View File

@ -15,30 +15,30 @@ const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===
const items = data.data[idx]; const items = data.data[idx];
// console.log(data.data[idx]) // console.log(data.data[idx])
--- ---
<Layout title={items.title} <Layout title={items.meta_title}
metaTitle={items.title} metaTitle={items.meta_title}
description={items.heading} description={items.meta_description}
ogImg={`https://api7.siliconpin.com/assets/${items.img}`} ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterCard="summary_large_image" tiwtterCard="summary_large_image"
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`} tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
tiwtterTitle={items.title} tiwtterTitle={items.meta_title}
tiwtterDesc={items.heading} tiwtterDesc={items.meta_description}
tiwtterURL=`https://barta-india.in/technology/${items.slug}` tiwtterURL=`https://barta-india.in/technology/${items.slug}`
artPubTime={items.date_created} artPubTime={items.date_created}
ogSiteName=`https://barta-india.in/technology/${items.slug}` ogSiteName=`https://barta-india.in/technology/${items.slug}`
ogType='News' ogType='News'
ogTitle={items.title} ogTitle={items.meta_title}
ogDesc={items.heading} ogDesc={items.meta_description}
ogURL=`https://barta-india.in/technology/${items.slug}` ogURL=`https://barta-india.in/technology/${items.slug}`
canonical=`https://barta-india.in/technology/${items.slug}`
> >
<main> <main>
<section class="container mx-auto px-4 mt-16"> <section class="container mx-auto px-4 mt-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<h1 class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1> <div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
<h2 class="text-xl py-2">{items.title}</h2> <h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
<div class="flex flex-col place-items-center"> <div class="flex flex-col place-items-center">
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} class="md:w-[40%]" /> <img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
</div> </div>
<div class="flex flex-row justify-center md:justify-end mt-2"> <div class="flex flex-row justify-center md:justify-end mt-2">
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit"> <div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
@ -54,6 +54,35 @@ const items = data.data[idx];
</section> </section>
</main> </main>
</Layout> </Layout>
<script is:inline>
let isListening = false;
let speechSynthesisInstance = window.speechSynthesis;
function toggleSpeech() {
if (isListening) {
stopSpeech();
} else {
startSpeech();
}
}
function startSpeech() {
let message1 = document.getElementById('message1').innerText;
let message2 = document.getElementById('message2').innerText;
let allSpeechText = message1 + ' ' + message2;
let speechText = new SpeechSynthesisUtterance(allSpeechText);
speechSynthesisInstance.speak(speechText);
document.getElementById('listenButton').innerText = 'Stop';
isListening = true;
}
function stopSpeech() {
speechSynthesisInstance.cancel();
document.getElementById('listenButton').innerText = 'Listen';
isListening = false;
}
</script>
<style> <style>
section > div > p > p { section > div > p > p {
text-align: justify; text-align: justify;

View File

@ -25,42 +25,60 @@ const items = metaJSON.data[0];
ogTitle={items.title} ogTitle={items.title}
ogDesc={items.description} ogDesc={items.description}
ogURL=`https://barta-india.in/technology/` ogURL=`https://barta-india.in/technology/`
canonical=`https://barta-india.in/technology`
> >
<main> <main>
<section class="container mx-auto px-4"> <section class="container mx-auto px-4">
<div class="my-16"> <div class="my-16">
<span class="text-[#780a0a] font-bold" id="pageName"></span> <span class="text-[#780a0a] font-bold" id="pageName"></span>
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1> <h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined;}) => {data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-6 place-content-between rounded-lg"> <div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col">
<a href={`/technology${items.slug}`} class="border-b-4 border-[#780a0a] text-2xl font-bold line-clamp-1">{items.heading}</a> <div class="">
<h2 class="text-lg line-clamp-1">{items.title}</h2> <a class="flex flex-col" href={`/technology/${items.slug}`}>
<img class="aspect-video " src={`https://api7.siliconpin.com/assets/${items.img}`} alt={items.title} /> <a class="flex flex-col" href={`/${items.slug}`}>
<div class="h-[100px] overflow-y-hidden"> <img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<p id="" set:html={items.content}></p> <h2 class="text-lg text-justify">{items.title}</h2>
</a>
</div>
<div>
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
<form method="dialog">
<div class="flex flex-col md:flex-col">
<a href={`/technology/${items.slug}`} class="flex flex-col md:flex-col">
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
<h1 class="text-lg font-bold">{items.heading} </h1>
<h2 class="text-justify ">{items.in_brief}</h2>
</a>
<div class="flex flex-row place-content-between place-items-center">
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
</div>
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>&#10008;</button>
</div>
</div>
</div>
</form>
</dialog>
</div>
</div>
<div class="flex flex-row place-content-between">
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
<p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
<a href={`/technology/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
</div> </div>
</div> </div>
<div class="flex justify-end">
<a href={`/technology/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Read More</a>
</div>
</div>
)} )}
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
</div> </div>
<!-- <div class="flex flex-col"> </section>
{data.map((items: {heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined;}) => </main>
<div class="flex flex-col border-2 gap-6 p-6">
<h1 class="border-b-4 border-[#780a0a] text-2xl font-bold">{items.heading}</h1>
<h2 class="text-lg">{items.title}</h2>
<img src={`https://api7.siliconpin.com/assets/${items.img}`} alt=""/>
</div>
)}
</div> -->
</section>
</main>
</Layout> </Layout>
<script is:inline> <script is:inline>
const pageName = window.location.href.split('/')[3]; const pageName = window.location.href.split('/')[3];

View File

@ -1,7 +1,7 @@
--- ---
import Layout from "../layouts/Layout.astro" import Layout from "../layouts/Layout.astro"
--- ---
<Layout title="Terms & Conditions | Barta-India" canonical=`https://barta-india.in/terms-and-conditions`> <Layout title="Terms & Conditions | Barta-India">
<main> <main>
<div class="mt-16"> <div class="mt-16">
<section class="container mx-auto px-4 "> <section class="container mx-auto px-4 ">

140
src/pages/weather.astro Normal file
View File

@ -0,0 +1,140 @@
<main>
<div>
<section class="container mx-auto px-4">
<div id="swicthDIVBG">
<p id="cityName"></p>
<p id="temper"></p>
<p id="description"></p>
</div>
</section>
<div class="flex flex-col justify-center place-items-center fixed top-[50%] right-[50%] bg-white md:max-w-lg w-full p-6 rounded-2xl shadow-xl" style="display: none;" id="weatherPermission">
<p>know weather information allow location Permission</p>
<div class="flex flex-row gap-6">
<button id="yesButton" class="border-2 border-[#580a0a] text-[#580a0a] px-4 py-2 rounded-xl">Allow</button>
<button id="noButton" class="border-2 border-[#580a0a] text-[#580a0a] px-4 py-2 rounded-xl">Deny</button>
</div>
</div>
<!-- <div class="bg-red-500 text-black" id="weatherInfo"></div> -->
</div>
</main>
<script is:inline>
async function getCurrentLocation() {
return new Promise((resolve, reject) => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => resolve(position.coords),
(error) => reject(error)
);
} else {
reject(new Error('Geolocation is not supported by this browser.'));
}
});
}
async function getCityName(latitude, longitude) {
const apiKey = '4d54049b61eb45c4b121ab2cff9808ba'; // Replace with your OpenCage API key
const apiUrl = `https://api.opencagedata.com/geocode/v1/json?q=${latitude}+${longitude}&key=${apiKey}`;
try {
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error('Error fetching data from the server.');
}
const data = await response.json();
if (data.results && data.results.length > 0) {
const city = data.results[0].components.city;
return city;
} else {
throw new Error('City not found.');
}
} catch (error) {
console.error('Error:', error.message);
throw new Error('Error fetching city name.');
}
}
async function getWeatherData(city) {
const apiKey = 'aed8dd87581613e1d2bbbf63eeb618da';
const apiUrl = `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${apiKey}`;
try {
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error('Error fetching weather data from the server.');
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error:', error.message);
throw new Error('Error fetching weather data.');
}
}
async function showCityName() {
try {
const location = await getCurrentLocation();
const city = await getCityName(location.latitude, location.longitude);
// document.getElementById('weatherInfo').innerText = 'Current City: ' + city;
const weatherData = await getWeatherData(city);
displayWeather(weatherData);
} catch (error) {
console.error(error.message);
// document.getElementById('weatherInfo').innerText = 'Error fetching data.';
}
}
function displayWeather(data) {
// const weatherInfoDiv = document.getElementById('weatherInfo');
// Extract relevant information from the API response
const cityName = data.name;
const temperature = data.main.temp;
const description = data.weather[0].description;
document.getElementById('cityName').innerHTML= 'City: ' + cityName;
document.getElementById('temper').innerHTML = 'Temperature: ' + temperature;
document.getElementById('description').innerHTML = 'Description: ' + description;
let switchBG = document.innerHTML = description;
if (switchBG === 'clear sky') {
let clearSkyBG = document.getElementById('swicthDIVBG').style.backgroundImage = 'url(/img/clear_sky.webp)';
clearSkyBG.style.backgroundRepeat = 'no-repeat';
clearSkyBG.style.backgroundSize = 'cover';
}
// Display the weather information switchDiv.style.backgroundImage = 'url("path/to/clear-sky-image.jpg")';
// weatherInfoDiv.innerHTML = `
// <p>City: ${cityName}</p>
// <p>Temperature: ${temperature} °C</p>
// <p>Description: ${description}</p>
// `;
}
function windowOnload() {
document.getElementById('weatherPermission').style.display = 'block';
// Attach click event handlers to the buttons
document.getElementById('yesButton').addEventListener('click', onYesButtonClick);
document.getElementById('noButton').addEventListener('click', onNoButtonClick);
}
function onYesButtonClick() {
// Call the function to display the city name and weather information
showCityName();
// Hide the weather permission div
document.getElementById('weatherPermission').style.display = 'none';
}
function onNoButtonClick() {
// Hide the weather permission div without fetching weather information
document.getElementById('weatherPermission').style.display = 'none';
}
window.onload = windowOnload;
</script>

View File

@ -1126,6 +1126,27 @@
"@babel/helper-validator-identifier" "^7.22.5" "@babel/helper-validator-identifier" "^7.22.5"
to-fast-properties "^2.0.0" to-fast-properties "^2.0.0"
"@bytescale/sdk@^3.27.0":
version "3.30.0"
resolved "https://registry.yarnpkg.com/@bytescale/sdk/-/sdk-3.30.0.tgz#60ccc6313462c1e1806c49d7e4405944cce69da6"
integrity sha512-VCV4MrK5Ig7tjeWc5RKwfd9Zg6ihDv0Y1buctEg/FfY8nly15/bpFMhFDw50PzR3FuCmg7RprMQ76rj8G3iWCw==
"@bytescale/upload-widget-vue@^4.13.0":
version "4.13.0"
resolved "https://registry.yarnpkg.com/@bytescale/upload-widget-vue/-/upload-widget-vue-4.13.0.tgz#ce733f2938cbaf27de1545c0aee0cedad65527d5"
integrity sha512-CT/P72NahAnwVwzQi6gAuA5DlKmKV/+j4H4aypaoisdYI1ukH3OYrEKv4Vl52lHZ8PgfFDUqopXrC6PzrkDtNA==
dependencies:
"@bytescale/upload-widget" "^4.23.0"
"@bytescale/upload-widget@^4.23.0":
version "4.23.0"
resolved "https://registry.yarnpkg.com/@bytescale/upload-widget/-/upload-widget-4.23.0.tgz#b662bba1fb21f39b0a6f927a263ad41dab6c629d"
integrity sha512-gG1JPGcAynn6y0XEbeFNk+7qYcMwQ7qmSvxwp+NEEpf9W12hkSGfoRulKtSKVf38oSmSag2Dks30PfEKiUnW7w==
dependencies:
"@bytescale/sdk" "^3.27.0"
classnames "^2.2.6"
preact "^10.6.5"
"@emmetio/abbreviation@^2.3.3": "@emmetio/abbreviation@^2.3.3":
version "2.3.3" version "2.3.3"
resolved "https://registry.yarnpkg.com/@emmetio/abbreviation/-/abbreviation-2.3.3.tgz#ed2b88fe37b972292d6026c7c540aaf887cecb6e" resolved "https://registry.yarnpkg.com/@emmetio/abbreviation/-/abbreviation-2.3.3.tgz#ed2b88fe37b972292d6026c7c540aaf887cecb6e"
@ -1536,6 +1557,18 @@
"@typescript-eslint/types" "5.61.0" "@typescript-eslint/types" "5.61.0"
eslint-visitor-keys "^3.3.0" eslint-visitor-keys "^3.3.0"
"@upload-io/upload-api-client-upload-js@^2.18.0":
version "2.18.0"
resolved "https://registry.yarnpkg.com/@upload-io/upload-api-client-upload-js/-/upload-api-client-upload-js-2.18.0.tgz#948cf288ace5ef22a152b37096335fda2ef7cc5c"
integrity sha512-yPwsRCecXSilYn4q5ZDD4fyI2PVyUcLimv2LQcfpV3hRyzc8t82NuWHYEYpRZa5K68zxw2RljDf30geT1vJN9g==
"@upload-io/vue-uploader@^3.37.1":
version "3.37.1"
resolved "https://registry.yarnpkg.com/@upload-io/vue-uploader/-/vue-uploader-3.37.1.tgz#ba3cca104b89c71bbf9ea45e421eb2293554633f"
integrity sha512-iY6tUGCoOxHsKg5myeXB38rLKpIU5F1awW4gw9ze6p6ne4GHI5M77AhHShjPEa2zylQh6wzny7F0AU4cfiRA+w==
dependencies:
uploader "^3.47.0"
"@vitejs/plugin-vue-jsx@^2.0.1": "@vitejs/plugin-vue-jsx@^2.0.1":
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue-jsx/-/plugin-vue-jsx-2.1.1.tgz#7c13aa4e54f5ee8c9f37937b3d8c706c14369478" resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue-jsx/-/plugin-vue-jsx-2.1.1.tgz#7c13aa4e54f5ee8c9f37937b3d8c706c14369478"
@ -2150,6 +2183,11 @@ ci-info@^3.3.1:
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.8.0.tgz#81408265a5380c929f0bc665d62256628ce9ef91" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.8.0.tgz#81408265a5380c929f0bc665d62256628ce9ef91"
integrity sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw== integrity sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==
classnames@^2.2.6:
version "2.5.1"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b"
integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==
cli-boxes@^3.0.0: cli-boxes@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-3.0.0.tgz#71a10c716feeba005e4504f36329ef0b17cf3145" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-3.0.0.tgz#71a10c716feeba005e4504f36329ef0b17cf3145"
@ -4762,6 +4800,11 @@ postcss@^8.1.10, postcss@^8.4.14, postcss@^8.4.18, postcss@^8.4.23:
picocolors "^1.0.0" picocolors "^1.0.0"
source-map-js "^1.0.2" source-map-js "^1.0.2"
preact@^10.6.5:
version "10.19.3"
resolved "https://registry.yarnpkg.com/preact/-/preact-10.19.3.tgz#7a7107ed2598a60676c943709ea3efb8aaafa899"
integrity sha512-nHHTeFVBTHRGxJXKkKu5hT8C/YWBkPso4/Gad6xuj5dbptt9iF9NZr9pHbPhBrnT2klheu7mHTxTZ/LjwJiEiQ==
preferred-pm@^3.0.3: preferred-pm@^3.0.3:
version "3.0.3" version "3.0.3"
resolved "https://registry.yarnpkg.com/preferred-pm/-/preferred-pm-3.0.3.tgz#1b6338000371e3edbce52ef2e4f65eb2e73586d6" resolved "https://registry.yarnpkg.com/preferred-pm/-/preferred-pm-3.0.3.tgz#1b6338000371e3edbce52ef2e4f65eb2e73586d6"
@ -4807,6 +4850,11 @@ prismjs@^1.28.0:
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12" resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12"
integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q== integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==
progress-smoother@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/progress-smoother/-/progress-smoother-1.7.0.tgz#77a5d77b19ce55ef81fdf02007ba6213df08ee5e"
integrity sha512-ZIbSbPQ8SnEf5Sa0If9lfvn5URyrZfgTTh5DM+04j1GafiLIaWDWW+1AkYXzGl7JQvzAvCy5E1ZPOgx8XORyew==
prompts@^2.4.2: prompts@^2.4.2:
version "2.4.2" version "2.4.2"
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069"
@ -5846,6 +5894,23 @@ update-browserslist-db@^1.0.11:
escalade "^3.1.1" escalade "^3.1.1"
picocolors "^1.0.0" picocolors "^1.0.0"
upload-js@^2.22.0:
version "2.24.3"
resolved "https://registry.yarnpkg.com/upload-js/-/upload-js-2.24.3.tgz#cf18a2d4f726d247380d5b89b336a0c8b28f3e92"
integrity sha512-iiTowtr2uRw2coGXlqiN1ff/wfMPVMv2MqaZYqEYBSNGmxD1pLl9R9wU8BT/mK+Yn8fDx7utlPovXziS8PVaIA==
dependencies:
"@upload-io/upload-api-client-upload-js" "^2.18.0"
progress-smoother "^1.7.0"
uploader@^3.47.0:
version "3.48.3"
resolved "https://registry.yarnpkg.com/uploader/-/uploader-3.48.3.tgz#5b7f8c57ff115e42ab66d9aed68b1c7f2a544f1a"
integrity sha512-BGXSS9O54m81TL5Ogn4OHISD/WPuIS3kvNCYomDl8cltPGzUMrHseU1sXHKGrFg65L28qJL6LnGA2fXUxpQVBQ==
dependencies:
classnames "^2.2.6"
preact "^10.6.5"
upload-js "^2.22.0"
uri-js@^4.2.2: uri-js@^4.2.2:
version "4.4.1" version "4.4.1"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"