Asciidoctor에서 생성 된 모든 HTML 페이지에 Google Analytics 또는 Google 태그 관리자 코드를 추가하려면 어떻게합니까? an extension이 있지만 메이븐 저장소에서 사용할 수 없습니다. asciidoctor-maven-plugin
을 사용하고 있습니다.Asciidoctor : asciidoctor-maven-plugin을 사용하여 모든 HTML 페이지에 Google Analytics 코드를 추가하는 방법
0
A
답변
0
파일이 동일한 디렉토리에 index.adoc
인 경우 index-docinfo-footer.html
파일을 만들고 해당 adoc 파일에 :docinfo:
을 추가하십시오. 다음
<script type="text/javascript">
dataLayer = [{'channel' : '{html-googleTagManagerChannel}', 'additional_tracking_code' : '{html-googleAnalyticsId}'}];
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{html-googleTagManagerId}');</script>
<noscript><iframe src="//www.googletagmanager.com/ns.html?id={html-googleTagManagerId}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
그리고 당신의 pom.xml에서 같은 것을 할 : 바닥 글 파일이
채우기
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<configuration>
<attributes>
<html-googleAnalyticsId>UA-123456789-1</html-googleAnalyticsId>
<html-googleTagManagerId>GTM-ABCDE</html-googleTagManagerId>
<html-googleTagManagerChannel>MyProject</html-googleTagManagerChannel>
</attributes>
</configuration>
1
확장 프로그램이 RubyGems에 게시 된 경우 TorqueBox RubyGems Maven Proxy Repository으로 종속성을 다운로드 할 수 있습니다.
asciidoctor 예제에서 asciidoctor-pdf-with-theme-example을 살펴보십시오.