File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 22document . addEventListener ( 'DOMContentLoaded' , ( event ) => {
33 const zulipOrg = "clojurians.zulipchat.com" ;
44 const zulipChannel = "clojurecivitas" ;
5- const slug = window . location . pathname . split ( '/' ) . pop ( ) . replace ( / \. h t m l $ / , '' ) ;
5+ const title =
6+ document . querySelector ( '#title-block-header h1.title' ) ?. textContent . trim ( ) ;
67
7- if ( slug ) {
8- const zulipURL = `https://${ zulipOrg } /#narrow/stream/${ zulipChannel } /topic/${ slug } ` ;
9- const linkHTML = `<p><a href="${ zulipURL } ">Discuss ${ slug } on Zulip</a></p>` ;
8+ if ( title ) {
9+ const encodedTitle = encodeURIComponent ( title ) ;
10+ const zulipURL = `https://${ zulipOrg } /#narrow/stream/${ zulipChannel } /topic/${ encodedTitle } ` ;
11+ const linkHTML = `<p><a href="${ zulipURL } ">Discuss ${ title } on Zulip</a></p>` ;
1012 document . getElementById ( 'quarto-content' ) . insertAdjacentHTML ( 'beforeend' , linkHTML ) ;
1113 }
1214} ) ;
You can’t perform that action at this time.
0 commit comments