Dynamic sitemap.xml for Steemdocs.net

in utopian-io •  last year  (edited)

Repository

https://github.com/steemdocs/steemdocs
PR: https://github.com/steemdocs/steemdocs/pull/41

New Features

  • What feature(s) did you add?

Steemdocs.net needed a solution for generating a dynamic sitemap.xml file in order the https://steemdocs.net to be indexed by the search engines.

Considering a nature of the project, it is really critical for the site content to be "searchable" by people using modern search engines.

Why it should be generated dynamically?

Well, more and more content is being added to steemdocs.net, so we do not now want to update sitemap.xml manually each time, right?

More about the issue described by @cryptoctopus in his feature request here: https://steemit.com/steemdocs/@cryptoctopus/steemdocs-net-bounty-dynamic-sitemap-xml-50-steem-upvote-from-utopian-and-me

The change is already on production, so you can see a result of the contribution here:

https://steemdocs.net/sitemap.xml

  • How did you implement it/them?

In a first step, I just prepared a simple script, which does the thing:

A vuepress internal file (node_modules/vuepress/lib/app/.temp/siteData) includes a list of generated ( during a build process ) sites. What we need to do is simply take the file content, and generate sitemap.xml with a proper structure based on that. A sitemap package was used, to generate XML file.

The script was STRONGLY based on already existing sitemap-generator plugin for vuepress based projects (https://github.com/ekoeryanto/vuepress-plugin-sitemap)

Unfortunately, the plugin could not have been used within the steemdocs project, due to non-existing ( at the time ) support for latest vuepress version.

The issue was posted here: https://github.com/ekoeryanto/vuepress-plugin-sitemap/issues/1

Thanks God, open-source community is responsive, so in the next few hours an author of the plugin has published a new version. I could finally take an advantage of his work, and link the plugin with the steemdocs repo. Custom script (presented above) was no longer needed, as the plugin did the job out-of-the-box.

Simple project build (npm run build) forces plugin to run and generate sitemap.xml to be created in an output directory.

Basic plugin configuration requires site host to be specified:

Two Unit Tests has been added in order to check the very basics of the generated sitemap.xml:

produce (2048×2320)

It would be really nice to see even more people contribution to such a great project - steemdocs.net.

Cheers.

GitHub Account

https://github.com/adasq

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi there,

It was a pleasure to read the story of this feature. :)

On a side note, looks like .MD files on this directory are in place in the sitemap.xml file.

It might be good to handle this case since they're not really pages served in the website. (helper files for the contributors.)

Screen Shot 2018-10-29 at 7.08.02 PM.png


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

@emrebeyler wow, thanks for your in-depth review. Such a high quality work is being done by the Utopian mods here.

I will raise an issue on github related to your note.

Great, thanks!

Thank you for your review, @emrebeyler! Keep up the good work!

Hi @adasq!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Congratulations @adasq! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You received more than 3000 upvotes. Your next target is to reach 4000 upvotes.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Trick or Treat - Publish your scariest halloween story and win a new badge
SteemitBoard notifications improved

Support SteemitBoard's project! Vote for its witness and get one more award!

Hi, @adasq!

You just got a 0.39% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Hey, @adasq!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!