Discourse 호스팅 커뮤니티에서 관리자로서 배지에 LinkedIn 공유 버튼을 추가하려고 합니다.
이를 위해 이 플러그인 아울렛을 사용하려고 합니다. 테마의 head 섹션에 다음 코드를 포함했습니다.
<script type='text/x-handlebars' data-template-name='/connectors/badge-contents-top/linkedin-button'>
<a href="https://www.linkedin.com/profile/add?certUrl=https://community.my_community.io{{@outletArgs.url}}" class="linkedin-share-button">
<img src="https://download.linkedin.com/desktop/add2profile/buttons/en_US.png " alt="LinkedIn Add to Profile button">
</a>
</script>
href 속성에 주목해 주세요: https://www.linkedin.com/profile/add?certUrl=https://community.my_community.io/{{@outletArgs.url}}.
@outletArgs.url 값은 https://community.my_community.io/badges/<badge_id>/<badge_name>?username=<username>과 같은 형태입니다. 저는 username=<username> 부분에 집중하고 싶습니다.
URL은 인코딩되지 않았고, 등호(=)가 그대로 전달되므로 브라우저가 https://www.linkedin.com/profile/add?certUrl=https://community.my_community.io/https://community.my_community.io/badges/<badge_id>/<badge_name>?username=<username>을 처리할 때 =<username>을 무시합니다.
여기서 URL을 어떻게 인코딩해야 하나요?