2025-05-08 문자온 사이트 SEO 개선 작업
This commit is contained in:
parent
17cb89a192
commit
d1b034529e
56
src/main/java/itn/let/utl/user/service/IndexNowUtil.java
Normal file
56
src/main/java/itn/let/utl/user/service/IndexNowUtil.java
Normal file
@ -0,0 +1,56 @@
|
||||
package itn.let.utl.user.service;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("indexNowUtil")
|
||||
public class IndexNowUtil {
|
||||
|
||||
private static final String INDEXNOW_API_URL = "https://api.indexnow.org/indexnow";
|
||||
private static final String INDEXNOW_KEY = "d09a9f949e6e48eeb221d7a13bdb1d14"; // 🔁 여기에 실제 키 입력
|
||||
private static final String HOST = "www.munjaon.co.kr"; // 🔁 도메인만 입력 (https:// 없이)
|
||||
|
||||
public static void submitUrl(String urlToSubmit) {
|
||||
try {
|
||||
URL url = new URL(INDEXNOW_API_URL);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("Content-Type", "application/json; utf-8");
|
||||
connection.setDoOutput(true);
|
||||
|
||||
// JSON 데이터 구성
|
||||
String jsonInputString = "{"
|
||||
+ "\"host\":\"" + HOST + "\","
|
||||
+ "\"key\":\"" + INDEXNOW_KEY + "\","
|
||||
+ "\"urlList\":[\"" + urlToSubmit + "\"]"
|
||||
+ "}";
|
||||
|
||||
try (OutputStream os = connection.getOutputStream()) {
|
||||
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
|
||||
os.write(input, 0, input.length);
|
||||
}
|
||||
|
||||
int responseCode = connection.getResponseCode();
|
||||
if (responseCode == 200 || responseCode == 202) {
|
||||
System.out.println("✅ IndexNow 전송 성공: " + urlToSubmit);
|
||||
} else {
|
||||
System.out.println("❌ 전송 실패 - 응답 코드: " + responseCode + " : " + urlToSubmit);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("🚫 오류 발생: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public static void main(String[] args) {
|
||||
// 테스트용 URL 전송
|
||||
submitUrl("https://yourdomain.com/new-post.html"); // 🔁 여기에 전송할 실제 URL 입력
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -40,6 +40,16 @@ function fnInsertView(){
|
||||
document.listForm.action = "<c:url value='/sym/site/metaTagInsertView.do'/>";
|
||||
document.listForm.submit();
|
||||
}
|
||||
|
||||
//indexnow
|
||||
function fnIndexNow(){
|
||||
if(confirm("index 처리 합니까?")) {
|
||||
document.listForm.action = "<c:url value='/sym/site/selectMetaTagIndex.do'/>";
|
||||
document.listForm.submit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fnView(metaTagNo){
|
||||
document.listForm.metaTagNo.value = metaTagNo ;
|
||||
document.listForm.action = "<c:url value='/sym/site/metaTagModifyView.do'/>";
|
||||
@ -103,6 +113,8 @@ function fnDelete(){
|
||||
<option value='10' <c:if test="${searchVO.pageUnit == '10' or searchVO.pageUnit == ''}">selected</c:if>>10줄</option>
|
||||
<option value='20' <c:if test="${searchVO.pageUnit == '20'}">selected</c:if>>20줄</option>
|
||||
<option value='30' <c:if test="${searchVO.pageUnit == '30'}">selected</c:if>>30줄</option>
|
||||
<option value='100' <c:if test="${searchVO.pageUnit == '100'}">selected</c:if>>100줄</option>
|
||||
<option value='500' <c:if test="${searchVO.pageUnit == '500'}">selected</c:if>>500줄</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -181,6 +193,7 @@ function fnDelete(){
|
||||
<input type="button" class="btnType1" onclick="fnInsertView(); return false;" value="등록">
|
||||
</div>
|
||||
|
||||
|
||||
<c:if test="${!empty metaTagList}">
|
||||
<div class="page">
|
||||
<ul class="inline">
|
||||
@ -189,6 +202,10 @@ function fnDelete(){
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<div class="btnWrap">
|
||||
<input type="button" class="btnType1" onclick="fnIndexNow(); return false;" value="indexnow">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
<div class="banner">
|
||||
<img src="/publish/publish_adv/img/banner.jpg" alt="배너">
|
||||
<div class="title">
|
||||
<h1 style="color:lightgray;">단체문자 발송하는 방법 총정리(갤럭시, 아이폰, 문자사이트)</h1>
|
||||
<p>단체문자 발송하는 방법 총정리<span>(갤럭시, 아이폰, 문자사이트)</span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
<div class="banner">
|
||||
<img src="/publish/publish_adv/img/banner.jpg" alt="배너">
|
||||
<div class="title">
|
||||
<h1 style="color:lightgray;">단체문자</h1>
|
||||
<p>단체문자</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -66,6 +66,7 @@
|
||||
<div class="banner">
|
||||
<img src="/publish/publish_adv/img/banner.jpg" alt="배너">
|
||||
<div class="title">
|
||||
<h1 style="color:lightgray;">문자보내기</h1>
|
||||
<p>문자보내기</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
<div class="banner">
|
||||
<img src="/publish/publish_adv/img/banner.jpg" alt="배너">
|
||||
<div class="title">
|
||||
<h1 style="color:lightgray;">문자발송</h1>
|
||||
<p>문자발송</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user