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

ready urls context ? #38

Open
Ahmed7fathi opened this issue Mar 22, 2020 · 3 comments
Open

ready urls context ? #38

Ahmed7fathi opened this issue Mar 22, 2020 · 3 comments

Comments

@Ahmed7fathi
Copy link

is there a ready urls context like {{ facebook_url }} instead of {% post_to_facebook object_or_url %}
i only need a the share link

@fcurella
Copy link
Owner

Hi!

You can use {% post_to_facebook_url <object_or_url> %}, and it will populate a variable called {{ facebook_url }} in your context.

@johndevor
Copy link

johndevor commented Feb 16, 2023

Seems to be dumping all of the template's context for some reason right into the template, as opposed to setting the variable. This appears on my site when I run the code at the bottom:

...<TextNode: '\n\n\n\n'>]>}, {'forloop': {'parentloop': {}, 'counter0': 0, 'counter': 1, 'revcounter': 4, 'revcounter0': 3, 'first': True, 'last': False}, 'post': <Post: test post #2>}, {'post': <Post: test post #2>, 'facebook_url': 'https://www.facebook.com/sharer/sharer.php?u=http%3A//localhost%3A8181/listings/test-post-2/'}]

When I have at the top of my template:

{% load social_share %}

{% post_to_facebook_url post %}


<div class="card border p-2 my-3">
    <div class="row g-0">

Keep in mind this is inside a for loop, outputting the posts.

Any ideas?

@johndevor
Copy link

Made a workaround:

{% post_to_facebook_url post as facebook_url_list %}

{{facebook_url_list.facebook_url}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants