<%
'***********************************************************************
'* DİNAMİK SİTEMAP
'* ================
'* Tüm sayfaların SEO dostu SiteMap'ini oluşturur
'* Arama motorlarının siteyi daha iyi keşfetmesini sağlar
'***********************************************************************
Response.ContentType = "application/xml"
Response.Charset = "UTF-8"
Response.CacheControl = "no-cache, must-revalidate"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1

' XML başlığı
Response.Write "<?xml version=""1.0"" encoding=""UTF-8""?>"
Response.Write "<urlset xmlns=""http://www.sitemaps.org/schemas/sitemap/0.9"" xmlns:xhtml=""http://www.w3.org/1999/xhtml"">"

'***********************************************************************
'* STATİK SAYFALAR
'***********************************************************************
Response.Write "<!-- Statik sayfalar -->"
Response.Write "<url>"
Response.Write "    <loc>https://www.siteadi.com/</loc>"
Response.Write "    <lastmod>" & FormatDateTime(Now(), "yyyy-mm-dd") & "</lastmod>"
Response.Write "    <changefreq>daily</changefreq>"
Response.Write "    <priority>1.0</priority>"
Response.Write "    <xhtml:link rel=""alternate"" hreflang=""tr"" href=""https://www.siteadi.com/tr/""/>"
Response.Write "    <xhtml:link rel=""alternate"" hreflang=""en"" href=""https://www.siteadi.com/en/""/>"
Response.Write "    <xhtml:link rel=""alternate"" hreflang=""de"" href=""https://www.siteadi.com/de/""/>"
Response.Write "    <xhtml:link rel=""alternate"" hreflang=""ru"" href="" https://www.siteadi.com/ru/""/>"
Response.Write "</url>"

'***********************************************************************
'* DİNAMİK SAYFALAR - OURTEAM
'***********************************************************************
Set rsTeam = conn.Execute("SELECT projectID, teamFullname, createDate FROM team_members WHERE status=1 ORDER BY createDate DESC")
Do While Not rsTeam.EOF
    teamSlug = ConvertToSEOUrl(rsTeam("teamFullname"))
    
    Response.Write "<url>"
    Response.Write "    <loc>https://www.siteadi.com/tr/ourteam/" & teamSlug & "</loc>"
    Response.Write "    <lastmod>" & FormatDateTime(rsTeam("createDate"), "yyyy-mm-dd") & "</lastmod>"
    Response.Write "    <changefreq>weekly</changefreq>"
    Response.Write "    <priority>0.7</priority>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""tr"" href=""https://www.siteadi.com/tr/ourteam/" & teamSlug & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""en"" href=""https://www.siteadi.com/en/ourteam/" & GetourteamUrl(rsTeam("projectID"), "en") & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""de"" href=""https://www.siteadi.com/de/ourteam/" & GetourteamUrl(rsTeam("projectID"), "de") & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""ru"" href=""https://www.siteadi.com/ru/ourteam/" & GetourteamUrl(rsTeam("projectID"), "ru") & ""/>"
    Response.Write "</url>"
    
    rsTeam.MoveNext
Loop

'***********************************************************************
'* DİNAMİK SAYFALAR - PRODUCTS
'***********************************************************************
Set rsProducts = conn.Execute("SELECT projectID, projectTitle, createDate FROM product_records WHERE status=1 ORDER BY createDate DESC")
Do While Not rsProducts.EOF
    productSlug = ConvertToSEOUrl(rsProducts("projectTitle"))
    
    Response.Write "<url>"
    Response.Write "    <loc>https://www.siteadi.com/tr/products/" & productSlug & "</loc>"
    Response.Write "    <lastmod>" & FormatDateTime(rsProducts("createDate"), "yyyy-mm-dd") & "</lastmod>"
    Response.Write "    <changefreq>weekly</changefreq>"
    Response.Write "    <priority>0.8</priority>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""tr"" href=""https://www.siteadi.com/tr/products/" & productSlug & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""en"" href=""https://www.siteadi.com/en/products/" & GetproductsUrl(rsProducts("projectID"), "en") & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""de"" href=""https://www.siteadi.com/de/products/" & GetproductsUrl(rsProducts("projectID"), "de") & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""ru"" href=""https://www.siteadi.com/ru/products/" & GetproductsUrl(rsProducts("projectID"), "ru") & ""/>"
    Response.Write "</url>"
    
    rsProducts.MoveNext
Loop

'***********************************************************************
'* DİNAMİK SAYFALAR - CORPORATE
'***********************************************************************
Set rsCorporate = conn.Execute("SELECT projectID, projectTitle, createDate FROM corporate WHERE status=1 ORDER BY createDate DESC")
Do While Not rsCorporate.EOF
    corporateSlug = ConvertToSEOUrl(rsCorporate("projectTitle"))
    
    Response.Write "<url>"
    Response.Write "    <loc>https://www.siteadi.com/tr/corporate/" & corporateSlug & "</loc>"
    Response.Write "    <lastmod>" & FormatDateTime(rsCorporate("createDate"), "yyyy-mm-dd") & "</lastmod>"
    Response.Write "    <changefreq>monthly</changefreq>"
    Response.Write "    <priority>0.6</priority>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""tr"" href=""https://www.siteadi.com/tr/corporate/" & corporateSlug & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""en"" href=""https://www.siteadi.com/en/corporate/" & GetCorporateUrl(rsCorporate("projectID"), "en") & ""/>"
    Response.Write "    <xhtml: link rel=""alternate"" hreflang=""de"" href=""https://www.siteadi.com/de/corporate/" & GetCorporateUrl(rsCorporate("projectID"), "de") & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""ru"" href=""https://www.siteadi.com/ru/corporate/" & GetCorporateUrl(rsCorporate("projectID"), "ru") & ""/>"
    Response.Write "</url>"
    
    rsCorporate.MoveNext
Loop

'***********************************************************************
'* DİNAMİK SAYFALAR - SERVICES
'***********************************************************************
Set rsServices = conn.Execute("SELECT projectID, projectTitle, createDate FROM services WHERE status=1 ORDER BY createDate DESC")
Do While Not rsServices.EOF
    servicesSlug = ConvertToSEOUrl(rsServices("projectTitle"))
    
    Response.Write "<url>"
    Response.Write "    <loc>https://www.siteadi.com/tr/services/" & servicesSlug & "</loc>"
    Response.Write "    <lastmod>" & FormatDateTime(rsServices("createDate"), "yyyy-mm-dd") & "</lastmod>"
    Response.Write "    <changefreq>monthly</changefreq>"
    Response.Write "    <priority>0.6</priority>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""tr"" href=""https://www.siteadi.com/tr/services/" & servicesSlug & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""en"" href=""https://www.siteadi.com/en/services/" & GetservicesUrl(rsServices("projectID"), "en") & ""/>"
    Response.Write "    <xhtml:link rel="" alternate"" hreflang=""de"" href=""https://www.siteadi.com/de/services/" & GetservicesUrl(rsServices("projectID"), "de") & ""/>"
    Response.Write "    <xhtml:link rel=""alternate"" hreflang=""ru"" href=""https://www.siteadi.com/ru/services/" & GetservicesUrl(rsServices("projectID"), "ru") & ""/>"
    Response.Write "</url>"
    
    rsServices.MoveNext
Loop

' Diğer sayfalar için benzer mantık...
' certificates, humanresources, solutionpartners, editorials, promovideos, newsroom

'***********************************************************************
'* SİTEMAP KAPAT
'***********************************************************************
Response.Write "</urlset>"

' Recordset'leri temizle
If Not rsTeam Is Nothing Then
    rsTeam.Close
    Set rsTeam = Nothing
End If

If Not rsProducts Is Nothing Then
    rsProducts.Close
    Set rsProducts = Nothing
End If

If Not rsCorporate Is Nothing Then
    rsCorporate.Close
    Set rsCorporate = Nothing
End If

If Not rsServices Is Nothing Then
    rsServices.Close
    Set rsServices = Nothing
End If

' FormatDateTime fonksiyonu (eğer yoksa eklemelidir)
Function FormatDateTime(dt, format)
    If IsDate(dt) Then
        FormatDateTime = Year(dt) & "-" & Right("0" & Month(dt), 2) & "-" & Right("0" & Day(dt), 2)
    Else
        FormatDateTime = "2024-01-01"
    End If
End Function
%>
