Fix go-sitemap-generator overriding GOMAXPROCs#141
Merged
Conversation
This upgrades the library to v2, which lets you specify that GOMAXPROCs should always be the max number of CPUs -- and then sets it to that. One side effect of this is that images are no longer listed in sitemaps. I'm somehow at a loss on how to build and append the images array we need, with the library's latest changes. Fixes #86
thebaer
commented
Jul 26, 2019
sitemap.go
Outdated
| imgs = append(imgs, stm.URL{{"loc", i}, {"title", ""}}) | ||
| } | ||
| // FIXME: this is a pain. At a loss on how to do this | ||
| u = append(u, []interface{}{[]interface{}{"image": imgs}}) |
Member
Author
There was a problem hiding this comment.
@robjloranger Could you help out with this whenever you have a chance?
changed to use stm.URL for imgs for readability fixed error in append statement reordered import statements
Member
Author
|
Thanks for taking a look, @robjloranger. Now when I try to get the sitemap on a blog that has posts which include images, I get this error: |
|
ok I think I fixed it, I will test locally myself before pushing the commit |
<urlset xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>http://localhost:8080/rob/image-test</loc>
<lastmod>2019-08-01T23:35:29Z</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
<mobile:mobile/>
<image:image>
<image:loc>https://static1.srcdn.com/wordpress/wp-content/uploads/2019/07/Harley-Quinn-DC-Universe-Batman-and-Harley.jpg</image:loc>
<image:title/>
</image:image>
</url>
<url>
<loc>http://localhost:8080/rob/testing-this-thing</loc>
<lastmod>2019-07-01T22:03:09Z</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
<mobile:mobile/>
</url>
<url>
<loc>http://localhost:8080/rob/</loc>
<lastmod>2019-08-01T23:35:29Z</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
</urlset>How's this look? One post in my collection with an image results in this output with no error. |
Member
Author
|
Yep, looks good! |
Member
Author
|
Perfect, works for me as well! Merging now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This upgrades the
go-sitemap-generatorlibrary to v2, which lets you specify that GOMAXPROCs should always be the max number of CPUs -- and then sets it to that.One side effect of this is that images are no longer listed in sitemaps. I'm somehow at a loss on how to build and append the images array we need, with the library's latest changes. Ideally we'd fix this -- any help would be much appreciated.
Fixes #86