blog: 글 주소를 영문 slug로 바꾸고 기존 주소를 aliases로 유지 - #343
Closed
haksungjang wants to merge 1 commit into
Closed
Conversation
블로그 글의 주소에 한국어 제목이 그대로 들어가고 있었다. 퍼머링크 규칙 '/:section/:year/:month/:day/:slug/' 에서 :slug 가 프런트매터 slug 없이 title 을 변환하기 때문이다. 각 글에 영문 slug 를 지정해 폴더 이름에 맞춘 주소를 쓰도록 한다. 기존 주소는 aliases 로 남겨 옛 링크로 들어와도 새 주소로 이동한다. 한국어 42개, 영어 3개가 대상이다(영어는 제목이 이미 영문이라 주소가 바뀌는 글이 적다). 폴더 이름을 소문자로 바꾸면 단어가 붙어 읽기 어려운 세 건과 폴더 이름에 오타가 있던 한 건은 slug 를 따로 지정했다. 20210328-ElasticLicense → elastic-license 20210728-GPLv2Installation… → gplv2-installation-information 20240923_gpl_opennwrt → gpl-openwrt hugo.toml 은 바꾸지 않았다. slug 를 명시하면 기존 규칙이 그 값을 쓰므로 다른 섹션에는 영향이 없다. 20240219_orange_lasso 디렉토리 이름에 백스페이스 제어문자가 섞여 있어 함께 정리한다.
Collaborator
Author
|
PR #344가 머지되면서 기준 브랜치가 삭제되어 이 PR이 자동으로 닫혔다. 같은 내용으로 #345를 새로 열었다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
블로그 글 주소에 한국어 제목이 그대로 들어가던 것을 영문 주소로 바꾼다. PR #342에 이어지는 작업이라 #341, #342를 먼저 머지해야 한다.
원인
:slug는 프런트매터에slug가 있으면 그 값을, 없으면title을 변환한 값을 쓴다. 블로그 글은slug를 하나도 지정하지 않아 한국어 제목이 그대로 주소가 되고 있었다.변경 내용
각 글에 폴더 이름을 근거로 한 영문
slug를 넣었다.hugo.toml은 바꾸지 않았다.slug를 명시하면 기존 규칙이 그 값을 쓰므로 다른 섹션에는 영향이 없다.기존 주소는
aliases로 남겼다. Hugo가 옛 주소에 리다이렉트 문서를 만들어, 밖에서 걸어 둔 링크로 들어와도 새 주소로 이동한다. 한국어 42개, 영어 3개가 대상이다(영어는 제목이 이미 영문이라 주소가 바뀌는 글이 적다).폴더 이름을 소문자로 바꾸면 단어가 붙어 읽기 어려운 두 건과, 폴더 이름 자체에 오타가 있던 한 건은
slug를 따로 지정했다.20210328-ElasticLicenseelastic-license20210728-GPLv2InstallationInformationgplv2-installation-information20240923_gpl_opennwrtgpl-openwrt함께 정리한 것
사이트 안에서 블로그를 가리키던 하드코딩 링크를 새 주소로 고쳤다(9개 파일). 이 가운데 상당수는 원래부터 존재한 적 없는 경로를 가리키고 있었다.
content/*/blog/2024/20240219_orange_lasso디렉토리 이름에 백스페이스 제어문자(0x08)가 섞여 있어 함께 제거했다. 주소는slug로 지정하므로 영향이 없지만, 폴더 이름 자체를 바로잡아 둔다.확인
npm run build성공canonical과meta refresh가 모두 들어감범위에서 뺀 것
태그 페이지(
/tags/오픈소스-라이선스/등 119개)는 태그 이름 자체가 한국어여서 주소도 한국어다. 영문 주소로 바꾸려면 태그마다_index.md를 만들어slug를 지정해야 하고 새 태그를 쓸 때마다 같은 일이 필요하다. 한국어 사이트의 한국어 태그이므로 그대로 둔다.