Skip to content

Conversation

@gustavoramos00
Copy link

If the content of "og:url" meta is empty, automatically detect the URL using $location.absUrl() service.

Disclaimer
I found this change very usefull in my project. But, I'm not JS specialist, so I don't know if this is the best approach to resolve this problem.

This is my first Pull Request in github.

@jvandemo
Copy link
Owner

@gustavoramos00 — Thank you for your contribution. Congrats on your first contribution 👍

Just to make sure I understand correctly, if you have:

<meta property="og:url" content="http://some.url"></meta>

you would then use:

<update-meta property="og:url" content=""></update-meta>

in a template to replace it with the absolute url of the current location?

Do I understand correctly? Thanks!

@gustavoramos00
Copy link
Author

Exactly @jvandemo ! I tested as bellow, don't know if has difference.

<update-meta property="og:url"></update-meta>

Sorry for the delay in reply.

@jvandemo
Copy link
Owner

I'm really hesitant on this one. I like the idea but I'm not sure if it is explicit enough.

One may see unexpected side-effects when a website is hosted on multiple domains.

Maybe a more explicit approach where $location.absUrl() is explicitly specified as the value could be more transparent in case you really want to do this.

Great work on the PR though @gustavoramos00 👍

I'll leave it open for others to share their opinion. If no one else has an interest in this then I will close it in a month.

Thanks again @gustavoramos00!

@gustavoramos00
Copy link
Author

gustavoramos00 commented Aug 4, 2016

Good point, @jvandemo. Even whether this behavior occurs only when no URL is provided, it doesn't seem explicit enough. What do you think about add other attribute, like this?

<update-meta property="og:url" use-abs-url="true"></update-meta>

@jvandemo
Copy link
Owner

@gustavoramos00 — The attribute is an interesting approach indeed. Curious to hear what others think. Nice work!

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

Successfully merging this pull request may close these issues.

2 participants