Giter Club home page Giter Club logo

Comments (4)

cameronrr avatar cameronrr commented on September 21, 2024 1

From your code, script will be like:

<script>
export default {
  metaInfo() {
    return {
      title: this.$page.documentation.title,

      // just include a link property in this returned object here
      link: [{ rel: 'canonical', href: `${this.getBaseUrl}${this.$page.documentation.path}/` }],

      meta: [
        {
          key: 'description',
          name: 'description',
          content: this.$page.documentation.excerpt,
        },
        { name: 'description', content: this.$page.documentation.excerpt },
        { name: 'twitter:card', content: 'summary_large_image' },
        {
          name: 'twitter:description',
          content: this.$page.documentation.excerpt,
        },
        { name: 'twitter:title', content: this.$page.documentation.title },
        {
          name: 'twitter:site',
          content: `@${this.$static.metadata.siteAuthor}`,
        },
        {
          name: 'twitter:image',
          content: `${this.getBaseUrl}/default-thumb.png`,
        },
        {
          name: 'twitter:creator',
          content: `@${this.$static.metadata.siteAuthor}`,
        },
        { property: 'og:type', content: 'document' },
        { property: 'og:title', content: this.$page.documentation.title },
        {
          property: 'og:description',
          content: this.$page.documentation.excerpt,
        },
        {
          property: 'og:url',
          content: `${this.getBaseUrl}${this.$page.documentation.path}/`,
        },
        {
          property: 'og:image',
          content: `${this.getBaseUrl}/default-thumb.png`,
        },
        {
          property: 'og:image:secure_url',
          content: `${this.getBaseUrl}/default-thumb.png`,
        },
      ],
    }
  },

  components: {
    AppSidebar: () => import('~/components/parts/AppSidebar'),
  },
}
</script>

from gridsome.

cameronrr avatar cameronrr commented on September 21, 2024

You can return an array of 'link' as well as 'meta'. An example below. I might have added siteUrl to the config to access it via a static query like is shown here.

<script>
export default {
  metaInfo() {
    const pathUrl = `${this.$static.metadata.siteUrl}${this.$route.path}`
    return {
      link: [{ rel: 'canonical', href: pathUrl }],
      meta: [{ property: 'og:url', content: pathUrl }],
    }
  },
}
</script>

from gridsome.

snowmanstudio avatar snowmanstudio commented on September 21, 2024

can you please implement this in above code and give full ? Thanks

from gridsome.

snowmanstudio avatar snowmanstudio commented on September 21, 2024

can I insert multiple <script> tag..?

from gridsome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.