New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/sittipongwork/GoSitemapxml

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/sittipongwork/GoSitemapxml

  • v0.0.0-20161123104827-ebd05028e4be
  • Source
  • Go
  • Socket score

Version published
Created
Source

The sitemap.xml for golang , SEO (Search Engine Optimization)

Installing

Use Golang CLI

go get github.com/sittipongwork/GoSitemapxml

or

Github Repository

https://github.com/sittipongwork/GoSitemapxml.git

Import Package

example : Import to go

  import "github.com/sittipongwork/GoSitemapxml"

Full Example include Create Sitemap Container, Addsite, Parse struct to xml

example

  //Create Sitemap Container for keep data xml
  sitemap := gositemap.CreateSitemapContainer("https://www.sitemaps.org/schemas/sitemap/0.9")

  //Add Site you want to show in sitemap.xml
  sitemap.AddSite("https://website.com/", "2016-11-23")
  //You can add more one site : Example
  sitemap.AddSite("https://website.com/blog/1", "2016-11-23")
  sitemap.AddSite("https://website.com/blog/2", "2016-11-23")
  sitemap.AddSite("https://website.com/blog/3", "2016-11-23")
  sitemap.AddSite("https://website.com/contact", "2016-11-23")

  //Mashal XML Data
  output, _ := xml.MarshalIndent(sitemap, "  ", "    ")
  //Print Output
  os.Stdout.Write(output)

  //NOTE : in iris framework
  //you can run command , Dont MashalIndent
  //iris.XML(iris.StatusOK, sitemap)

output

<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://website.com/</loc>
    <lastmod>2016-11-23</lastmod>
  </url>
  <url>
    <loc>https://website.com/blog/1</loc>
    <lastmod>2016-11-23</lastmod>
  </url>
  <url>
    <loc>https://website.com/blog/2</loc>
    <lastmod>2016-11-23</lastmod>
  </url>
  <url>
    <loc>https://website.com/blog/3</loc>
    <lastmod>2016-11-23</lastmod>
  </url>
  <url>
    <loc>https://website.com/contact</loc>
    <lastmod>2016-11-23</lastmod>
  </url>
</urlset>

FAQs

Package last updated on 23 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc