

NOTE: As mentioned in comments since you are asking for the full path of the image, the best way to do it would sticking with the first approach. What sociology is and how it relates to technology Sociology is defined as 'The science of human society. Over time, the purpose of social media has changed. Public conversations made involvement from outside parties possible.

To access the base URL we can get origin property from it like this: (For using this method in next.js this may probably help). When social media first became popular, its general concept was a paradigm between people (sociology) and technology. Use javascript built-in methods like window.location. |_let's say this will return assets/images/image.png If we are in index file we will refer to that image like this: Using a relative path, in this approach, you should use image relative path which work like this ( this may help with it): Meta Tags and SEO Nuxt gives you 3 different ways to add meta data to your application: Globally using the Locally using the head as an object Locally using the head as a function so that you have access to data and computed properties.
#SOCIAL MEDIA META IMAGE SCRIPT CODE#
Remember: If you are using this code on a page that is also loading Shareaholic, this code snippet must come before the line that loads Shareaholic.js in the header, or else the code snippet will not work.There are several ways to achieve such a thing:Ĭreate your base URL in env file and refer it by proccess.env ( This may help with this approach). Finally, we append this newly created meta tag element to your tag on your page, and you're off and running! To break it down a little, this code first creates a meta tag element, then we set the name or property (Open Graph uses "property") attribute of the meta tag, as well as the content of the meta tag. tAttribute('name', 'shareaholic:site_id') To add the Shareaholic Site ID for site ownership purposes: On sites like Facebook, Twitter, and Linkedin, your meta image is 3x larger than your text content Create Meta Tags for SEO and Digital Marketing. To set the "shareaholic:url" meta tag to the current URL displayed in the address bar: Var link = document.createElement('meta') ĭocument.getElementsByTagName('head').appendChild(link) To set the "og:url" Open Graph meta tag to the current URL displayed in the address bar: No matter what your particular use case is, the custom JavaScript code will follow the same basic structure. NOTE : If you are using this code snippet on a page where Shareaholic is installed, this code snippet must be included before Shareaholic.js loads on your page, so it must come before your Shareaholic Setup Code. This method will allow you to do so without having to contact your development team.įortunately, you can use some custom JavaScript to automatically and dynamically add these metatags to all of your pages quickly and easily! This code is also incredibly adaptable - you can set pretty much any meta tag and value that you'd like! You are a marketer or non-Dev using a Tag Manager like Google Tag Manager (GTM), and wish to insert the Shareaholic metatags on your site.This can be helpful in retrieving shares from different paths. If you want to specify the URL that the OpenGraph URL and/or Shareaholic:url meta tag points to, if it differs from your current.This section is called 'Creating Content with Metadata.' The secret of metadata is that the contents of Title, Main Image and Summary fields ARE the metadata that is used when making posts to social media. You can use the following custom JavaScript snippet to add your Shareaholic Site ID to the tag of the root domain, which will enable you to verify your site. It makes use of Title, Summary and Main Image. If you are using Shareaholic on a subpath of a root domain you own (like and want to verify the subpath.Some situations where this might arise are: The next section in our HTML5 boilerplate. As mentioned, all meta elements are optional but many have benefits for SEO and social media marketing. You may find yourself in a situation where you need to add a custom meta tag or Canonical URL to your template, and for any number of reasons, this can't be 'hard coded' into the tag - it needs to be dynamic based on each individual page. Open Graph Meta Elements for Social Cards.
