taycw Posted February 27, 2021 Share Posted February 27, 2021 I am trying to make the text "Notes, Queries and Explanations" at the top of the individual blog posts a link back to the home blog page. The text is currently added using the content attribute and am having trouble working out the javascript. What can I do to make that a link? Link to comment
creedon Posted February 27, 2021 Share Posted February 27, 2021 Add the following to Blog Settings > Advanced > Page Header Code Injection for the blog page. <script> $( ( ) => { /* begin add linked text to blog title SS Version : 7.0 Template : Brine family */ const text = 'NOTES, QUERIES AND EXPLANATIONS'; const url = '/notes-queries-and-explanations'; // do not change anything below, there be the borg here $( '<a>' + text + '</a>' ) .attr ( 'href', url ) .prependTo ( '.BlogItem-title' ); // end add linked text to blog title } ); </script> This is for a v7.0 site using the Brine template family. You can retarget your CSS from .BlogItem-title:before to .BlogItem-title a and make the minor adjustments needed. Let us know how it goes. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. Link to comment
taycw Posted February 28, 2021 Author Share Posted February 28, 2021 16 hours ago, creedon said: Add the following to Blog Settings > Advanced > Page Header Code Injection for the blog page. <script> $( ( ) => { /* begin add linked text to blog title SS Version : 7.0 Template : Brine family */ const text = 'NOTES, QUERIES AND EXPLANATIONS'; const url = '/notes-queries-and-explanations'; // do not change anything below, there be the borg here $( '<a>' + text + '</a>' ) .attr ( 'href', url ) .prependTo ( '.BlogItem-title' ); // end add linked text to blog title } ); </script> This is for a v7.0 site using the Brine template family. You can retarget your CSS from .BlogItem-title:before to .BlogItem-title a and make the minor adjustments needed. Let us know how it goes. Thanks! That did the trick! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.