Giter Site home page Giter Site logo

kevduc / html-xml-hreflang Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 54 KB

HTML hreflang ➡ XML Sitemap converter – Convert HTML hrefelang tags to a valid XML hreflang Sitemap

Home Page: https://kevduc.github.io/html-xml-hreflang/

License: GNU Lesser General Public License v3.0

Python 19.93% HTML 79.63% Batchfile 0.44%
html xml href hreflang converter sitemap sitemap-generator sitemap-xml link tag script scripting

html-xml-hreflang's Introduction

HTML hreflang ➡ XML Sitemap converter

Convert HTML hreflang tags to a valid XML Sitemap.

Follows the Google Guidelines: Tell Google about localized versions of your page.

📘 How to use

🌐 Online version

https://kevduc.github.io/html-xml-hreflang/

🐍 Python script

Run main.py, optionally specifying an input and/or output file, for example:

> python main.py -i test/test-input.html -o test/test-output.xml

Defaults to input.html for the input file and output.xml for the output file if not specified

👇 Example

input.html

<link rel="alternate" hreflang="en-gb" href="http://en-gb.example.com/page.html" />
<link rel="alternate" hreflang="en-us" href="http://en-us.example.com/page.html" />
<link rel="alternate" hreflang="en" href="http://en.example.com/page.html" />
<link rel="alternate" hreflang="de" href="http://de.example.com/page.html" />
<link rel="alternate" hreflang="x-default" href="http://www.example.com/" />

output.xml

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>http://en-gb.example.com/page.html</loc>
    <xhtml:link rel="alternate" hreflang="en-gb" href="http://en-gb.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="en-us" href="http://en-us.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="en" href="http://en.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="de" href="http://de.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="http://www.example.com/"/>
  </url>
  <url>
    <loc>http://en-us.example.com/page.html</loc>
    <xhtml:link rel="alternate" hreflang="en-gb" href="http://en-gb.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="en-us" href="http://en-us.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="en" href="http://en.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="de" href="http://de.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="http://www.example.com/"/>
  </url>
  <url>
    <loc>http://en.example.com/page.html</loc>
    <xhtml:link rel="alternate" hreflang="en-gb" href="http://en-gb.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="en-us" href="http://en-us.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="en" href="http://en.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="de" href="http://de.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="http://www.example.com/"/>
  </url>
  <url>
    <loc>http://de.example.com/page.html</loc>
    <xhtml:link rel="alternate" hreflang="en-gb" href="http://en-gb.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="en-us" href="http://en-us.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="en" href="http://en.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="de" href="http://de.example.com/page.html"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="http://www.example.com/"/>
  </url>
</urlset>

🎉 Support

Buy me a hot chocolate

html-xml-hreflang's People

Contributors

kevduc avatar

Watchers

 avatar

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.