jupiterbroadcasting.com icon indicating copy to clipboard operation
jupiterbroadcasting.com copied to clipboard

Show note links should open in a new tab

Open ironicbadger opened this issue 3 years ago • 7 comments

In order to preserve the users window in case they are playing a podcast episode show note links (or perhaps all external links?) should open in a new tab.

ironicbadger avatar Aug 15 '22 23:08 ironicbadger

This'll be interesting...I think the only way to ensure all external links open to a new window we'd have to do some javascript to add the target="_blank" for all links on the page :thinking:

Because particularly the shownotes, we're not able to access the links in that since they're hugo content (i.e. the MD part of the .md files under content/)

elreydetoda avatar Aug 16 '22 00:08 elreydetoda

Only external links...

ironicbadger avatar Aug 16 '22 00:08 ironicbadger

ya, we'll have to do an if statement as well to check if they're external.

i.e. everything under "Episode Links" for this episode: https://new.jupiterbroadcasting.com/show/office-hours/1/

Is defined here: https://github.com/JupiterBroadcasting/jupiterbroadcasting.com/blob/fae40bf883007e391d97babb34dffe6a5e0256a5/content/show/office-hours/0001.md?plain=1#L55-L59

elreydetoda avatar Aug 16 '22 00:08 elreydetoda

Do the show note links end up in a specific div or something? Could that be used?

ironicbadger avatar Aug 16 '22 00:08 ironicbadger

not currently, but we could add an id="content" or something. we'd still have to use JS to modify it all.

elreydetoda avatar Aug 16 '22 00:08 elreydetoda

BTW, I don't think this is required for the JB 1.0 milestone. If we're just getting it launched (MVP) I think this could be bumped to 2.0 and if someone has time to work on it then that'd be awesome.

elreydetoda avatar Aug 16 '22 09:08 elreydetoda

Or you could put something like <a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a> in themes/jb/layouts/_default/_markup/render-link.html To get <a href="https://daringfireball.net/2019/06/the_talk_show_live_from_wwdc_2019" title="The Talk Show Live From WWDC 2019" target="_blank" rel="noopener">The Talk Show Live From WWDC 2019</a> generated.

ozcoder avatar Oct 01 '22 11:10 ozcoder