Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Social Share Links to Page/Element #6736

Closed
4 tasks done
mweth opened this issue Feb 3, 2024 · 6 comments
Closed
4 tasks done

Add Social Share Links to Page/Element #6736

mweth opened this issue Feb 3, 2024 · 6 comments
Labels
change request Issue requests a new feature or improvement out of scope Issue requests something out of scope

Comments

@mweth
Copy link
Sponsor

mweth commented Feb 3, 2024

Context

For public facing instances, the ability to easily share a specific section, image, or page via social media will enhance content accessibility and enhance the user experience.

Description

This proposal is to integrate a social share link plugin within Material for MkDocs. This plugin would enable users to quickly share a link to a specific section (identified by page.md#heading), an image (either to the nearest section or page), or an entire page to various social media platforms. The plugin would automatically generate a shareable URL, which could be automatically generated and places with each page/section or be invoked (**Article ** { socialbutton }).
When clicked, it presents users with options to share the content on platforms like Twitter, LinkedIn, Facebook, and others, directly from the documentation site.

The ability to share specific sections or images allows for more targeted and relevant sharing. Users can highlight exactly what they find interesting or valuable, making the shared content more personalized and likely to engage others on social media.

This addition aligns with Material for MkDocs’ principles by:

Enhancing existing features: Social links are already a part of the footer logic and an existing library of icons and layout can be used to implement this feature.

extra:
  social:
    - icon: fontawesome/brands/mastodon 
      link: https://fosstodon.org/@squidfunk

Enhancing accessibility and usability: By making it easier for readers to share content, we extend the reach of the documentation to a wider audience, including those who rely on social media for discovering useful resources.

Maintaining simplicity: The plugin keeps the focus on Markdown content creation without requiring additional knowledge of HTML, CSS, or JavaScript from the document authors.

Promoting Openness and Community Engagement: The ability to share content easily on social media aligns with the open-source spirit of MKDocs, fostering community engagement and collaboration. It allows the content to reach a wider audience, encouraging feedback and contributions.

Supporting all devices: Given the prevalence of social media usage across various devices, this feature ensures that the documentation remains functional and accessible, regardless of the viewing device.

Being lightweight: The proposed feature aims to be fast and unobtrusive, maintaining the theme's commitment to performance and a minimal footprint.

Related links

Social links are already included in footer code: https://squidfunk.github.io/mkdocs-material/changelog/#1.0.0

https://squidfunk.github.io/mkdocs-material/setup/setting-up-social-cards/

https://github.com/squidfunk/mkdocs-material/blob/master/docs/plugins/meta.md

Use Cases

From an Author's Perspective:

Ease of Implementation: Authors can continue to focus on writing quality Markdown content without worrying about generating anchor links and highlighting them on pages/sections. With automatic or invoked share links, the user can decide when and where the share links appear.

Increased Visibility: By enabling social sharing, authors can more effectively promote their documentation across social media platforms, reaching a wider audience and potentially driving more engagement with their content. This feature aligns with the project's goal of creating accessible, high-quality documentation that serves the needs of a diverse user base.

From a User's Perspective:

Convenience: Heading anchors are not currently shareable. By adding this feature, users can easily share helpful sections, images, or pages with their network, enhancing the collaborative aspect of documentation. This functionality is particularly beneficial in educational, professional, and community settings where sharing resources is commonplace.

Enhanced User Experience: The plugin caters to the modern web user's expectations for interactivity and social connectivity, improving the overall user experience. It aligns with Material for MkDocs' principle of serving documentation that is adaptable and accessible across all devices.

Visuals

This is an example where a link image is clicked, which unfurls social links: https://dev.to/dsasse07/implementing-a-social-share-feature-jd7
Screenshot 2024-02-03 111923
Screenshot 2024-02-03 111926

Before submitting

@squidfunk
Copy link
Owner

Thanks for suggesting. We've evaluated this feature request and currently don't plan to directly add this functionality to Material for MkDocs because of its inherent complexity, and thus necessary effort to pull this off, and rather limited use, as it's likely only useful in blogging contexts to most people, since people usually don't share documentation pages on social media. There are several JavaScript based solutions that can be used out of the box. Additionally, this can be implemented as a third party plugin, as there's no need for a deep integration with Material for MkDocs.

@squidfunk squidfunk closed this as not planned Won't fix, can't repro, duplicate, stale Feb 4, 2024
@squidfunk squidfunk added change request Issue requests a new feature or improvement out of scope Issue requests something out of scope labels Feb 4, 2024
@squidfunk
Copy link
Owner

On a further note:

Heading anchors are not currently shareable.

They are if you enable toc.permalinks.

@mweth
Copy link
Sponsor Author

mweth commented Feb 4, 2024

On behalf of fellow dumb people who don't don't know what to Google, can you elaborate on the JavaScript based solutions that can be used out of the box and third party plugin route?

Also, THANK YOU for the permalinks note!

@mweth
Copy link
Sponsor Author

mweth commented Feb 4, 2024

EDIT: with toc.permalink enabled, 95% of my issue is solved. Thank you!

P.S. I'm sharing my public service project because it is a little different from what most people are using this for and you might find it amusing: Official Code of Georgia, Illustrated

@squidfunk
Copy link
Owner

@mweth Sure, I searched for "social share button js" and found plenty of options. However, glad that most of your issue is resolved! Note that many other features allow to share links, i.e. content tabs, as well as code annotations.

If anchors are nested within multiple levels of annotations, sharing them is currently not possible, but we will be working on that soon. Note that this is quite a complex topic given the infinite number of combinations authors can use this project, so please give us some time on that – we have it our backlog.

@squidfunk
Copy link
Owner

squidfunk commented Feb 4, 2024

On a further note, we're aware that this project is used in so many more ways than for what it is (or was originally) intended ☺️ We've seen authors using it for their bike shops, course work, personal home pages, digital gardens, yada yada yada. This was also one of the main motivations to build the blog plugin, in order to allow a wider audience to benefit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change request Issue requests a new feature or improvement out of scope Issue requests something out of scope
Projects
None yet
Development

No branches or pull requests

2 participants