Skip to content

Example Reddit social share URL interpolates relative URL rather than encoded absolute URL #1656

Closed
@tlindsay42

Description

@tlindsay42

Description

The custom Reddit social sharing link example on the Layouts page of the documentation specifies to populate the url parameter with {{ page.url | relative_url }}, which fails to populate the URL field in the popup window when implemented. If the interpolation syntax is replaced with the encoded absolute value: {{ page.url | absolute_url | url_encode }}, as implemented in the theme default social-share.html file, the URL field will populate properly in the popup window.

<a href="https://www.reddit.com/submit?url={{ page.url | relative_url }}&title={{ page.title }}" class="btn" title="{{ site.data.ui-text[site.locale].share_on_label }} Reddit"><i class="fab fa-fw fa-reddit" aria-hidden="true"></i><span> Reddit</span></a>

Environment


Expected behavior

The URL field should be populated with the page URL in the share on Reddit popup window.

Steps to reproduce the behavior

  1. Create an override social-share.html file and populate it with the code found here page of the documentation.
<a href="https://www.reddit.com/submit?url={{ page.url | relative_url }}&title={{ page.title }}" class="btn" title="{{ site.data.ui-text[site.locale].share_on_label }} Reddit">
  <i class="fab fa-fw fa-reddit" aria-hidden="true"></i><span> Reddit</span>
</a>
  1. Serve the site
  2. Navigate to a page with sharing enabled, and click on the Reddit link and the URL will not be populated.

Pull Request following momentarily.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions