Giter Site home page Giter Site logo

Comments (8)

aileen avatar aileen commented on May 29, 2024 1

You need to pass in a slug value for this plugin to work.

In your case, you can simply rename it as so:

slug: uid

or

slug:path

This should do the job. I will update the Readme to make sure, this is mentioned. Thanks for pointing it out!

from gatsby-plugin-advanced-sitemap.

GreatState avatar GreatState commented on May 29, 2024

Looks like it's an issue with

var slug = source === "allMarkdownRemark" || source === "allMdx" ? node.fields.slug.replace(/^\/|\/$/, "") : node.slug.replace(/^\/|\/$/, "");

I don't have slug in my query

from gatsby-plugin-advanced-sitemap.

GreatState avatar GreatState commented on May 29, 2024

How do we get round the issue of having sub elements?
allImageSharp { edges { node { id original { src } } } }

I'm trying to retrieve all images throughout the site. I can obviously alias original as

slug:original

but then the code will error as it's looking for node.slug.replace

from gatsby-plugin-advanced-sitemap.

GreatState avatar GreatState commented on May 29, 2024

HI, I can do this for other queries but for images it's another sub level

THis works

allSitePage {
              edges {
                node {
                  id
                  slug: path
                }
              }
            }

but for images the query is

allImageSharp {
    edges {
      node {
        fluid {
          slug: src
        }
      }
    }
  }

or


allImageSharp {
    edges {
      node {
        slug: fluid{
           src
        }
      }
    }
  }

which means it's still an extra level

from gatsby-plugin-advanced-sitemap.

GreatState avatar GreatState commented on May 29, 2024

. I was under the impression the slug had to be the URL of the image or resource?

from gatsby-plugin-advanced-sitemap.

GreatState avatar GreatState commented on May 29, 2024

I've got a bit further with it by detecting allImageSharp query
var slug = source === "allMarkdownRemark" || source === "allMdx" || source === "allImageSharp" ? node.fluid.slug.replace(/^\/|\/$/, "")

which seems to generating the xml now but the buikld breaks

rror: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type undefined
  
  - gatsby-node.js:275 
    [WebApp]/[gatsby-plugin-advanced-sitemap]/gatsby-node.js:275:34

from gatsby-plugin-advanced-sitemap.

GreatState avatar GreatState commented on May 29, 2024

Okay. I've realised why i think. Images need to be in a different format

<url>
       <loc>https://example.com/mens-hats</loc>
       <lastmod>2018-10-12</lastmod>
       <image:image>
          …
       </image:image>
    </url>

Looks like you can't link directly to an image in the url element?
https://www.practicalecommerce.com/seo-include-images-and-videos-in-sitemaps

from gatsby-plugin-advanced-sitemap.

GreatState avatar GreatState commented on May 29, 2024

Anyway of supporting images used on a page?

from gatsby-plugin-advanced-sitemap.

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.