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

Add preload meta link #105

Closed
farnabaz opened this issue Nov 27, 2020 · 1 comment · Fixed by #444
Closed

Add preload meta link #105

farnabaz opened this issue Nov 27, 2020 · 1 comment · Fixed by #444

Comments

@farnabaz
Copy link
Member

Supporting the preload attribute to add a preload meta link sounds like an interesting idea to improved page performance.

We should have answers to these questions:

  • When we need to add preload meta on a page?
  • We should support preload meta on nuxt-img?
  • What about responsive images with multiple sources (responsive), we should create a meta link for each source?
@shadow81627
Copy link
Contributor

I have an eager loaded banner image component at the top of my pages that I use to set the og image and add preload meta.

head() {
    return {
      meta: [
        {
          hid: 'og:image',
          property: 'og:image',
          content: `${this.$config.BASE_URL}${this.$img(this.src, {
            width: 1200,
            height: 630,
          })}`,
        },
        {
          hid: 'og:image:width',
          property: 'og:image:width',
          content: 1200,
        },
        {
          hid: 'og:image:height',
          property: 'og:image:height',
          content: 630,
        },
      ],
      link: [
        {
          rel: 'preload',
          as: 'image',
          href: `${this.$config.BASE_URL}${this.$img(this.src, {
            width: 1200,
            height: 630,
          })}`,
          imagesrcset: this._srcset.srcset,
          imagesizes: this._srcset.size,
        },
      ],
    };
  },

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 a pull request may close this issue.

2 participants