<?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">
  
  <!-- 홈페이지 -->
  <url>
    <loc>http://jinco.kr/</loc>
    <lastmod>2025-10-05</lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>
  
  <!-- 다른 페이지들 추가 예시 -->
  <url>
    <loc>http://jinco.kr/about</loc>
    <lastmod>2025-10-05</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  
  <url>
    <loc>http://jinco.kr/contact</loc>
    <lastmod>2025-10-05</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.7</priority>
  </url>
  
</urlset>

<?php
// sitemap.php - XML 사이트맵 자동 생성

header('Content-Type: application/xml; charset=utf-8');

$base_url = 'http://jinco.kr';

// 사이트의 페이지 목록 (데이터베이스에서 가져올 수도 있음)
$pages = [
    ['url' => '/', 'priority' => '1.0', 'changefreq' => 'daily'],
    ['url' => '/about', 'priority' => '0.8', 'changefreq' => 'monthly'],
    ['url' => '/services', 'priority' => '0.8', 'changefreq' => 'weekly'],
    ['url' => '/contact', 'priority' => '0.6', 'changefreq' => 'monthly'],
];

echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php foreach ($pages as $page): ?>
    <url>
        <loc><?php echo htmlspecialchars($base_url . $page['url']); ?></loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq><?php echo $page['changefreq']; ?></changefreq>
        <priority><?php echo $page['priority']; ?></priority>
    </url>
<?php endforeach; ?>
</urlset>
2. robots.txt 생성 코드
php
<?php
// robots.php - robots.txt 동적 생성

header('Content-Type: text/plain; charset=utf-8');

$base_url = 'http://jinco.kr';

echo "User-agent: *\n";
echo "Allow: /\n";
echo "Disallow: /admin/\n";
echo "Disallow: /private/\n\n";
echo "Sitemap: {$base_url}/sitemap.xml\n";
?>
3. SEO 최적화된 메타태그 클래스
php
<?php
// SEOHelper.php

class SEOHelper {
    private $title;
    private $description;
    private $keywords;
    private $url;
    private $image;
    
    public function __construct($title, $description, $keywords = '') {
        $this->title = $title;
        $this->description = $description;
        $this->keywords = $keywords;
        $this->url = 'http://jinco.kr' . $_SERVER['REQUEST_URI'];
    }
    
    public function setImage($image) {
        $this->image = $image;
    }
    
    public function renderMetaTags() {
        ?>
        <!-- 기본 메타 태그 -->
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title><?php echo htmlspecialchars($this->title); ?></title>
        <meta name="description" content="<?php echo htmlspecialchars($this->description); ?>">
        <?php if ($this->keywords): ?>
        <meta name="keywords" content="<?php echo htmlspecialchars($this->keywords); ?>">
        <?php endif; ?>
        
        <!-- Open Graph (Facebook, 카카오톡) -->
        <meta property="og:title" content="<?php echo htmlspecialchars($this->title); ?>">
        <meta property="og:description" content="<?php echo htmlspecialchars($this->description); ?>">
        <meta property="og:url" content="<?php echo htmlspecialchars($this->url); ?>">
        <meta property="og:type" content="website">
        <?php if ($this->image): ?>
        <meta property="og:image" content="<?php echo htmlspecialchars($this->image); ?>">
        <?php endif; ?>
        
        <!-- Twitter Card -->
        <meta name="twitter:card" content="summary_large_image">
        <meta name="twitter:title" content="<?php echo htmlspecialchars($this->title); ?>">
        <meta name="twitter:description" content="<?php echo htmlspecialchars($this->description); ?>">
        
        <!-- Canonical URL -->
        <link rel="canonical" href="<?php echo htmlspecialchars($this->url); ?>">
        <?php
    }
}

// 사용 예시
$seo = new SEOHelper(
    '진영석재',
    '석재시공 및 석재보수 공사를 전문으로 하는 진영석재 입니다',
    '진영석재,석재시공,석재보수,석재하자보수,석재파손,대리석,석재,석재수리'
);
$seo->setImage('http://jinco.kr/images/logo.jpg');
?>