jbub / ghostwriter

A port of ghostwriter theme to Hugo.
MIT License
177 stars 154 forks source link

Share links not mobile friendly and uses inline JS #59

Open madsolar8582 opened 6 years ago

madsolar8582 commented 6 years ago

In the post-footer.html partial template, the Twitter, Facebook, Google+, and LinkedIn options all attempt to open a window with a specific size: https://github.com/jbub/ghostwriter/blob/2340a01fea08ecfff62ee22551741180862156ce/layouts/partials/post-footer.html#L13-L44

This does not work on mobile and might need to specifically call out about:blank as the target so that a new tab can be used.

Additionally, since the JS for the onclick event is inlined, a CSP that disables inline JS cannot be used. To make sites that use this theme more secure, the JS needs to be pulled into its own file(s) and then referenced in the page.

dylanhthomas commented 4 years ago

This currently works on iOS. The inlining is less than ideal. If it was desired to keep the modal window on desktop, I think the following solution is pretty elegant: https://css-tricks.com/simple-social-sharing-links/

Otherwise, tend to recommend just making them plain links that open in a new tab/window.