on
PHP] 사이트맵(sitemap.xml) 생성하는 소스
PHP] 사이트맵(sitemap.xml) 생성하는 소스
XML 사이트맵을 생성하는 객체 기반 PHP 사이트맵 생성하는 소스
특징
누락된 기능을 구현하거나 추가 기능을 추가하는 데 도움을 주세요.
웹사이트용 사이트맵 생성
사이트맵 생성을 위한 다양한 옵션
특정 파일 유형만 보는 옵션
크롤링할 때 클라이언트 측 자바스크립트 콘텐츠 로드
모든 상대 링크 유형(// , # , ?) 등을 구문 분석합니다.
https://github.com/tristangoossens/php-sitemap-generator
php-sitemap-generator-main.zip 0.01MB
1. 다운로드후 sitemap-config.php 파일을 열고 웹사이트 주소로 변경
"SITE_URL" => "https://student-laptop.nl/", 이 부분을 찾아서
2. sitemap-config.php, sitemap-generator.php, sitemap.xml 3개의 파일을 운영중인 사이트에 올리고
(sitemap.xml은 권한을 777로 변경 필요)
3. 스크립트를 설치한 후 원하는 위치의 특정 페이지에 포함하여 스트립트 사용
include "/path/to/sitemap-generator.php"; 여러분의 환경에 맞게 적절히 수정합니다.
// Create an object of the generator class passing the config file $smg = new SitemapGenerator(include("sitemap-config.php")); // Run the generator $smg->GenerateSitemap();
4. 코드 삽입한 파일을 웹에서 실행(끝!)
그러면 구글이나 네이버에 등록할 수 있는 sitemap.xml 이 생성됩니다.
Config
You can alter some of the configs settings by changing the config values.
// Site to crawl and create a sitemap for. // https://www.your-domain-name.com/ or http://www.your-domain-name.com/ "SITE_URL" => "https://student-laptop.nl/", // Boolean for crawling external links. // *Domain = https://www.student-laptop.nl* , *Link = https://www.google.com* "ALLOW_EXTERNAL_LINKS" => false, // Boolean for crawling element id links. // will not be crawled when this option is set to false "ALLOW_ELEMENT_LINKS" => false, // If set the crawler will only index the anchor tags with the given id. // If you wish to crawl all links set the value to "" // When CRAWL_ANCHORS_WITH_ID is set to "internal-link" this link will be crawled // but will not be crawled. "CRAWL_ANCHORS_WITH_ID" => "", // Array with absolute links or keywords for the pages to skip when crawling the given SITE_URL. // https://student-laptop.nl/info/laptops or you can just input student-laptop.nl/info/ and it will not crawl anything in that directory // Try to be as specific as you can so you dont skip 300 pages "KEYWORDS_TO_SKIP" => array( "http://localhost/student-laptop/index", // I already have a href for root ("/") on my page so skip this page "/student-laptop/student-laptop.nl/", // Invalid link example ), // Location + filename where the sitemap will be saved. "SAVE_LOC" => "sitemap.xml", // Static priority value for sitemap "PRIORITY" => 1, // Static update frequency "CHANGE_FREQUENCY" => "daily", // Date changed (today's date) "LAST_UPDATED" => date('Y-m-d'), Output
https://student-laptop.nl/ 2021-03-10 daily 1 https://student-laptop.nl/underConstruction 2021-03-10 daily 1 https://student-laptop.nl/article?article_id=1 2021-03-10 daily 1
from http://webinstory.tistory.com/68 by ccl(A) rewrite - 2021-12-02 09:00:43