In a UX-focused discussion titled “Substitute Link Icon Only For Sharing,” cogdog highlights confusion caused by Discourse using the same “link” icon for both inserting hyperlinks in the editor and sharing posts in view mode. They propose using a more intuitive share icon (like ) for sharing, while preserving the link icon for editing. Initially, using the API to replace the icon affected both contexts, which was undesirable. Falco confirmed this would require a core Discourse change. The feature was implemented via a commit that introduced separate icon IDs: d-post-share and d-topic-sharepmusaraj. Users can now customize the share icon independently using:
However, cogdog notes that the desired icon (e.g., fa-share-square) must first be added to the SVG icon subset via admin -> settings -> svg icon subset. After updating, users can verify the change by inspecting the button’s class (should include d-icon-d-post-share) cogdog. The update is live and working for those who’ve upgraded and configured their theme header accordingly cogdog. Some users, like anon73664359, reported delays in seeing the change, likely due to version or configuration issues. ondrej and tachibanalolo confirmed the solution works once properly configured.
I find this part of the Discourse interface confusing. In the editor, the link icon is used for inserting a hyperlink (well this makes sense, this is what it should be and is the same as 99% of other interfaces)
But then this changes the icon in the editor, so it does not make sense to use a share icon to represent inserting a hyperlink. It would be helpful if there were separate API calls to reference the two contexts for this button, so I could substitute as a share link icon but not an insert link one.
??? (my knowledge of how discourse internally works is mostly shallow)
This would require a Discourse change. We would have to duplicate this icon internally while keeping both versions using the same icon by default so downstream users can target each individually to change it.
Once more, I am not looking for an icon! I can use any icon I want on my site.
What I want is a method in discourse, as specified in how to override an icon via the api, to change the button icon for sharing a post without changing the one used in the editor for the insert hyperlink button.
Thank you thank you! I was just trying to figure out why the class names for the share button icon here on meta were different from our up to date version of discourse.
Saw the change come through and available in updates, and ran it on our site. As a note to anyone else, using the icon requires it be added via admin -> settings -> svg icon subset using fa-share-square
I found there is one more step- you have to make this font-awesome icon available as an svg icon. Otherwise the button is blank after making the header theme adjustments
The update does not change anything except the class name for the share button icon, so you will not see a difference right away. The default is to keep the same link icon as before (link).
You can tell the update is done if you browser inspect the button and it includes the class d-icon-d-post-share (before the update the class was d-icon-link)