<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mikhail Starikov</title>
    <description>The latest articles on Forem by Mikhail Starikov (@dev_starikov).</description>
    <link>https://forem.com/dev_starikov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F87284%2Fcaf93434-74d2-4638-826d-8bce96f1ca16.jpg</url>
      <title>Forem: Mikhail Starikov</title>
      <link>https://forem.com/dev_starikov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/dev_starikov"/>
    <language>en</language>
    <item>
      <title>Working With Sitemaps in Nuxt.js</title>
      <dc:creator>Mikhail Starikov</dc:creator>
      <pubDate>Tue, 28 Sep 2021 14:27:41 +0000</pubDate>
      <link>https://forem.com/dev_starikov/working-with-sitemaps-in-nuxt-js-5dpf</link>
      <guid>https://forem.com/dev_starikov/working-with-sitemaps-in-nuxt-js-5dpf</guid>
      <description>&lt;h2&gt;
  
  
  Create a sitemap of routes, pages, and dynamic routes
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F9184%2F1%2AFwoYG5JlnSr1BSr4HY0L4A.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F9184%2F1%2AFwoYG5JlnSr1BSr4HY0L4A.jpeg" alt="Photo by [Nik Shuliahin](https://unsplash.com/@tjump?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText)"&gt;&lt;/a&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@tjump?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Nik Shuliahin&lt;/a&gt; on &lt;a href="https://unsplash.com/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hey to everyone reading this! In this article, I’d like to investigate the different options of creating sitemaps in &lt;a href="https://nuxtjs.org/" rel="noopener noreferrer"&gt;Nuxt&lt;/a&gt; using the &lt;a href="https://github.com/nuxt-community/sitemap-module" rel="noopener noreferrer"&gt;sitemap module&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want to create a sitemap of all your routes and pages and add dynamic routes, request your back-end API, or even if you want to create multiple sitemaps with a sitemap index file, this module will provide you with everything you want.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Sitemap module options.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simple single sitemap with routes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sitemap with requesting from API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sitemap for several indexes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sitemap for multi-lang websites.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Module Options
&lt;/h2&gt;

&lt;p&gt;Here are all the options available:&lt;br&gt;
&lt;a href="https://github.com/nuxt-community/sitemap-module#sitemap-options" rel="noopener noreferrer"&gt;&lt;strong&gt;nuxt-community/sitemap-module&lt;/strong&gt;&lt;br&gt;
*Automatically generate or serve dynamic sitemap.xml for Nuxt.js projects! Module based on the awesome sitemap.js…*github.com&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;route(&lt;code&gt;array | function&lt;/code&gt;)
You can manually add routes there to definitely put in the sitemap or use that property to request the routes from an API, so it can be dynamically generated from your DB.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;//...&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;catalog/best-offers&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;catalog/chairs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="c1"&gt;// or&lt;/span&gt;
  &lt;span class="na"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`my.own.api.com/getSitemapRoutes`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;p&gt;path (&lt;code&gt;string&lt;/code&gt;)&lt;br&gt;
This is a path to the sitemap. The default is /sitemap.xml for normal and /sitemapindex.xml if you use the sitemaps property.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;hostname (&lt;code&gt;string&lt;/code&gt;)&lt;br&gt;
If you define the hostname, it will be overridden for all the routes, regardless of the application domain. Module logic is that if the hostname is not defined, the application checks if the current request is HTTPS or not, and gets the current application domain. Then, the module builds a hostname based on that. If you use &lt;a href="https://github.com/nuxt-community/nuxt-i18n" rel="noopener noreferrer"&gt;nuxt-i18n&lt;/a&gt; and your app has several domains, the module should clearly define the current application based on the requesting domain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cacheTime (&lt;code&gt;number&lt;/code&gt;)&lt;br&gt;
This is the caching TTL of the sitemap routes that you defined before.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;exclude (&lt;code&gt;string[]&lt;/code&gt;)&lt;br&gt;
Here, you can either exclude some static routes for your Nuxt application:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;exclude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;catalog/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blog-*/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*.html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Or, specifically for the sitemap index, when you don’t want to duplicate static routes for each sitemap, you can do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// **&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;sitemaps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sitemap-normal.xml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;exclude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/cabinet&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/cabinet/*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/cabinet/recruiter/*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/account-removed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/search-by-cv&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sitemap-popular.xml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;getPopularSitemap&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;exclude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sitemap-some-other.xml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;getSitemapSomeOtherLinks&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;exclude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;filter (&lt;code&gt;function&lt;/code&gt;)&lt;br&gt;
You can pass a function to filter all options that Nuxt generates automatically from your routes. Example: &lt;a href="https://github.com/nuxt-community/sitemap-module#filter-optional---function" rel="noopener noreferrer"&gt;https://github.com/nuxt-community/sitemap-module#filter-optional---function&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;gzip (&lt;code&gt;boolean&lt;/code&gt;)&lt;br&gt;
Zip or not, it is up to you to decide.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Simple Single Sitemap With Routes
&lt;/h2&gt;

&lt;p&gt;So, usually if you have your own portfolio website or something like that, you want to generate a sitemap only with your static routes. Imagine that you have this structure for your website:&lt;/p&gt;

&lt;p&gt;Pages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Blog&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Projects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Posts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Index.vue&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And in the end, you just want to put it in the sitemap. You might end up with something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;sitemap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/sitemap.xml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;cacheTime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;trailingSlash&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;gzip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Sitemap With Dynamic Routes
&lt;/h2&gt;

&lt;p&gt;What do I mean by dynamic routes? Here is a route like &lt;code&gt;/blog/_post.vue&lt;/code&gt;, when you have a page of an element or something else.&lt;/p&gt;

&lt;p&gt;In that case, the module cannot generate those IDs on its own, of course, and that’s when the routes property comes in handy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;//...&lt;/span&gt;
&lt;span class="nl"&gt;sitemap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/sitemap.xml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;cacheTime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;trailingSlash&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;gzip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`my.own.api.com/getSitemapRoutes`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="c1"&gt;//or&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;getRoutes&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../util.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="c1"&gt;//...&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;getRoutes&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Several Indexes
&lt;/h2&gt;

&lt;p&gt;Now, having some static routes and dynamic routes, maybe it makes sense to have separate sitemaps for those.&lt;/p&gt;

&lt;p&gt;It becomes even more convenient when you have a lot of dynamic URLs and you want to separate them in different sitemaps. Here is my implementation of that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;//...&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getSitemapBlogsFn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sitemapIndex&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`http://my.own.api/sitemap_routes?index=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;sitemapIndex&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;offers&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
            &lt;span class="nx"&gt;offers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
                &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`http://myblog.org/blog/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;changefreq&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;daily&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;})),&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getSitemapsConfigurations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`sitemap-&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.xml`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;getSitemapBlogsFn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="na"&gt;cacheTime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;trailingSlash&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;exclude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;//here we exclude all static routes&lt;/span&gt;
    &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;span class="c1"&gt;//...&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="na"&gt;sitemap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/sitemap.xml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;sitemaps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
      &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sitemap-routes.xml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="na"&gt;cacheTime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="na"&gt;trailingSlash&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nf"&gt;getSitemapsConfigurations&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Under the hood in the back end, based on the index parameter, you need to change the OFFSET requesting elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sitemap for a Multi-Language Website
&lt;/h2&gt;

&lt;p&gt;Here, the only detail to worry about is not to set the hostname so the domain will be taken from the request that will come to the Nuxt server.&lt;/p&gt;

&lt;p&gt;Also, in case your domain hosting is via CNAME or Load balancer, then the request that will come to Nuxt will not be HTTPS, but simple HTTP.&lt;/p&gt;

&lt;p&gt;In that case, you need to make sure that your &lt;code&gt;x-forwarded-proto&lt;/code&gt; is set to HTTP in a request. Then, the module will recognize that the original request was HTTP and it will put an HTTPS link to the sitemap.&lt;/p&gt;

&lt;p&gt;On my startup &lt;code&gt;clusterjobs.de&lt;/code&gt; we had that option, when we need to have a multi-index sitemap that is dynamic and responds to each language domain. And, in the end, that module came quite handy.&lt;/p&gt;

&lt;p&gt;Hopefully, it was useful and it improves your Nuxt application or encourages you to use this incredible framework!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A Year With Nuxt.js - A Genuine Review of a Framework</title>
      <dc:creator>Mikhail Starikov</dc:creator>
      <pubDate>Fri, 25 Oct 2019 13:40:32 +0000</pubDate>
      <link>https://forem.com/dev_starikov/a-year-with-nuxt-js-geninue-review-of-a-framework-3ni8</link>
      <guid>https://forem.com/dev_starikov/a-year-with-nuxt-js-geninue-review-of-a-framework-3ni8</guid>
      <description>

&lt;p&gt;For more than a year I am working with nuxt.js on daily basis. In this review I would try to summarize all ups and downs while working with a framework. Hopefully this article may persuade you to try nuxt on your new project and you will also be aware of some caveats along the way, which I faced.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;TL;TR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have a year working with nuxt on daily basis.&lt;/li&gt;
&lt;li&gt;Nuxt is a very convenient and amazing for production.&lt;/li&gt;
&lt;li&gt;Nuxt is extendable and have lots of features and driven by vast and talented community&lt;/li&gt;
&lt;li&gt;Nuxt have caveats, which have some workaround but nothing is ideal :)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Benefits&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;performant&lt;/li&gt;
&lt;li&gt;structure&lt;/li&gt;
&lt;li&gt;community&lt;/li&gt;
&lt;li&gt;documentation (guides for testing, guides for deploying)&lt;/li&gt;
&lt;li&gt;modules (i18n, sitemap, svg, apollo, axios, pwa, sentry, GA, GTM)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Caveats&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;shared state problem (node problem)&lt;/li&gt;
&lt;li&gt;is-https and heroku (i18n multi domains, sitemap)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;this&lt;/code&gt; everywhere&lt;/li&gt;
&lt;li&gt;weak &lt;code&gt;rx.js&lt;/code&gt; support&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;One remark before I start, I don't know if it was an idea, but I just love how nuxt logo is mountain, like you are behind a reliable wall.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FMUgyLLV.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FMUgyLLV.jpg" alt="nuxt mountains logo"&gt;&lt;/a&gt;&lt;/p&gt;
nuxt mountains logo



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FB1qwLvM.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FB1qwLvM.jpg" alt="Using nuxt is like living in a mountains in calm and peace :)"&gt;&lt;/a&gt;&lt;/p&gt;
Using nuxt is like living in a mountains in calm and peace :)



&lt;h1&gt;
  
  
  Project
&lt;/h1&gt;

&lt;p&gt;First of all I want to give a small introfuction to the project. A year ago, in Oktober 2018 my friend &lt;a href="https://medium.com/@ramialsalman9" rel="noopener noreferrer"&gt;rami alsalman&lt;/a&gt; (Ph.D. in machine learning!) approached me and shared the pain of using job websites nowadays, f.e. you are trying to find &lt;code&gt;Software Backend Engineer php&lt;/code&gt; and you get a list of offers, with &lt;code&gt;python&lt;/code&gt;, &lt;code&gt;C#&lt;/code&gt;, &lt;code&gt;ASP.net&lt;/code&gt; and so on.&lt;/p&gt;

&lt;p&gt;All in all relevancy is poor sometimes because the recognition of offer description - like recognition of required programming skills, soft skills is the problem on it's own.&lt;/p&gt;

&lt;p&gt;The idea was to build a search system only around machine learning algorythms that will recognise any job offer description text, any search text and applicant CV, so we could directly show most matching jobs based on CV.&lt;/p&gt;

&lt;p&gt;That is how we came up with idea of &lt;a href="https://clusterjobs.de" rel="noopener noreferrer"&gt;clusterjobs.de&lt;/a&gt;. I was responsible for web application and became CTO of a startup and my friend became a CEO and machine learning search engine engineer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FZ3pk03s.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FZ3pk03s.jpg" alt="Search by CV with skills recognition"&gt;&lt;/a&gt;&lt;/p&gt;
Search by CV with skills recognition



&lt;h1&gt;
  
  
  Why nuxt?
&lt;/h1&gt;

&lt;p&gt;First of all I wanted to start a project with a long-term framework that will help us start fast and extend it in future. Other main point was to have SSR, cause we wanted to have &lt;em&gt;sustainable SEO&lt;/em&gt; as a main traffic channel. Having php on a backend for SSR would lead to duplicating all the templates and double work, which we couldn't afford, cause the dev team is just me :).&lt;/p&gt;

&lt;p&gt;I started to investigate javascript SSR solutions and nuxt seemed clearly a winner. There was 2.0.0 major release and good documentation, and decided to take a risk with a new technology on a new project and take nuxt as a framework for clusterjobs.&lt;/p&gt;

&lt;h1&gt;
  
  
  Deployment and CD with nuxt
&lt;/h1&gt;

&lt;p&gt;To save some time on manual deployments I invested couple of days to set up proper Gitlab pipeline to deploy app to heroku.&lt;br&gt;
Here is a &lt;a href="https://nuxtjs.org/faq/heroku-deployment/" rel="noopener noreferrer"&gt;great article on nuxt docs&lt;/a&gt; about deploying to heroku.&lt;br&gt;
Here is a &lt;a href="https://about.gitlab.com/blog/2017/09/12/vuejs-app-gitlab/" rel="noopener noreferrer"&gt;great article on how to deploy vue on heroku&lt;/a&gt; in gitlab Pipeline.&lt;br&gt;
Combine them together and BOOM! That is what I have at the moment:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;





&lt;h1&gt;
  
  
  A year of development
&lt;/h1&gt;

&lt;p&gt;After all environment was done it took roughly 2–3 months to prepare MVP and go live. Numerous iterations and improvements afterwards and till now I did not regret at any point of time that I chose nuxt.&lt;br&gt;
So why is it good? I thought of really best moments that I experienced and here they are:&lt;/p&gt;
&lt;h2&gt;
  
  
  Performance
&lt;/h2&gt;

&lt;p&gt;It is performant, even though it is full js framework that need to deliver all library files to the client it still tries it's best to do it in less harmful way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FysaQDwh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FysaQDwh.jpg" alt="93 points on performance metric in lighthouse"&gt;&lt;/a&gt;Lighthouse on slow 4G with 4x CPU slowdown on Mac pro&lt;/p&gt;

&lt;p&gt;With last 2.10 update I found out guys have updated webpack config so during development only updated chunks are rebuild, which really speed up development. Also webpack for production is extendable and you could play around with it on your own, or use default config which is pretty performant on it's own.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;My webpack build config. Here are &lt;a href="https://nuxtjs.org/api/configuration-build/#extend" rel="noopener noreferrer"&gt;the docs&lt;/a&gt; for this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structuring
&lt;/h2&gt;

&lt;p&gt;The good advantage is that I as a developer didn't need to think where to put this or that. Nuxt comes with a skeleton of app, with everything you need to build complex web app. Pages, components, assets, static, middlewares, plugins and so on.&lt;br&gt;
The only thing that pissed me off is that nuxt encourages you to use &lt;code&gt;~/component/blah-blah&lt;/code&gt; kind of stuff to import all over the application. &lt;br&gt;
So and JetBrains IDE, that I love with a bottom of my heart, couldn't recognise those pathes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F0ckb1a5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F0ckb1a5.jpg" alt="WebStorm fails to recognise a path :("&gt;&lt;/a&gt;WebStorm fails to recognise a path :(&lt;/p&gt;

&lt;p&gt;Workaround for that is pretty simple:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Name this file &lt;code&gt;phpstorm.webpack.config.js&lt;/code&gt; (Cause it is PHPStorm and not WEBStorm in my case 😛) and put it in the root folder of your nuxt app to make &lt;code&gt;~&lt;/code&gt; in you import pathes work!

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fu7sqHPO.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fu7sqHPO.jpg" alt="WebStorm is succeed to recognise a path now!"&gt;&lt;/a&gt;WebStorm is succeed to recognise a path now!&lt;/p&gt;
&lt;h2&gt;
  
  
  Community
&lt;/h2&gt;

&lt;p&gt;Community is living, huge thanks to &lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__73436"&gt;
    &lt;a href="/atinux" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F73436%2F03886a2b-d4bc-41d3-a656-b5495c5dc3a6.jpg" alt="atinux image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/atinux"&gt;Sébastien Chopin&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/atinux"&gt;Author of Nuxt.js • Community partner of Vue.js • Open Source&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
 who created nuxt itself and driving it till current moment, huge thanks to the Core Team and all contributors for such an amazing product. Probably if you tried nuxt you know these resources, but I just put them here:

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nuxtjs.org/guide/" rel="noopener noreferrer"&gt;Brand new updated nuxt website&lt;/a&gt; with guides, docs and everything you might be interested&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cmty.app/nuxt" rel="noopener noreferrer"&gt;Amazing platform for open source communities&lt;/a&gt;. All Issues, questions and so on regarding nuxt and nuxt-community modules&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Modules
&lt;/h2&gt;

&lt;p&gt;That is the thing that makes you love nuxt, really.&lt;br&gt;
Coming from such a great community nuxt has readjusted vue modules, new modules, modules for everything. Found som not covered use-case in nuxt? Write a module, make it nuxt-community open source!&lt;br&gt;
Here is a list of modules I use in production:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/nuxt-community/nuxt-i18n" rel="noopener noreferrer"&gt;&lt;strong&gt;i18n&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
 Internationalisation, with multi-domains for each language, working out of the box. Like isn't it awesome? Languages and separate domains is crucial for SEO and could improve your presence in Google results list heavily. And here you just need to add module, integrate it with your UI and that's it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/nuxt-community/sitemap-module" rel="noopener noreferrer"&gt;&lt;strong&gt;sitemap&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
 Also super important thing that is needed for every prod website. This module will generate sitemap based on your routes. You could also use axios th request your API and get all dynamic routes or whatever you want.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/nuxt-community/svg-module" rel="noopener noreferrer"&gt;&lt;strong&gt;svg&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
 Use svg all over the app, but load them from auto-generated sprite&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/nuxt-community/apollo-module" rel="noopener noreferrer"&gt;&lt;strong&gt;apollo&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
 GraphQL is awesome!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/nuxt-community/pwa-module" rel="noopener noreferrer"&gt;&lt;strong&gt;pwa&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
 PWA is our future, try to investigate this topic, if you still haven't done it yet! Upd. Samsung started to show PWA apps in Galaxy store!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/nuxt-community/sentry-module" rel="noopener noreferrer"&gt;&lt;strong&gt;sentry&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
 get to know your user's pain with awesome service that will log all production errors for you.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/nuxt-community/analytics-module" rel="noopener noreferrer"&gt;&lt;strong&gt;GA&lt;/strong&gt;&lt;/a&gt;, &lt;a href="https://github.com/nuxt-community/modules/tree/master/packages/google-tag-manager" rel="noopener noreferrer"&gt;&lt;strong&gt;GTM&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
 Necessary evil to track you app performance&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  Caveats
&lt;/h1&gt;

&lt;p&gt;There was some problems of course during the year of working with nuxt.&lt;br&gt;
Now I ll try to give context for each of them and help you avoid them in future:&lt;/p&gt;
&lt;h2&gt;
  
  
  Shared state on multiple requests in nuxt
&lt;/h2&gt;

&lt;p&gt;This is related to how node.js works. If you have a global variable, it will be overwritten in simultaneous request.&lt;br&gt;
Some insights are given in this &lt;a href="https://stackoverflow.com/questions/48550284/how-to-keep-multiple-requests-separate-in-nodejs-expressjs" rel="noopener noreferrer"&gt;Stack Overflow question&lt;/a&gt;.&lt;br&gt;
The problem that I experienced was related to fetch function on my offer-list page (search results).&lt;br&gt;
I was making action call like&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Making search on server sideThat was done to populate store on server side and use the same offers on client side.&lt;br&gt;
But when it is done inside action, like &lt;code&gt;action -&amp;gt; commit -&amp;gt; store&lt;/code&gt; then for some reason that data is mixed.&lt;br&gt;
I confess, I did not investigate the true reason of that, maybe some global object of Vuex store or something like that, but the problem was that&lt;br&gt;
while I had my application running for first request, every next request got it's state. So you might end up landing here &lt;a href="https://en.clusterjobs.de/search/fullstack%20developer" rel="noopener noreferrer"&gt;https://en.clusterjobs.de/search/fullstack developer&lt;/a&gt; and having machine learning engineer results.&lt;br&gt;
Fix for that was:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Committing directly from fetch function.

&lt;p&gt;So &lt;code&gt;action -&amp;gt; back to fetch -&amp;gt; commit -&amp;gt; state&lt;/code&gt;. Action should return a Promise wich is resolved with proper data, which you could use back in &lt;code&gt;fetch&lt;/code&gt; function.&lt;br&gt;
Probably after that point commit calls where close to the end of fetch and page had correct data, but general problem might be still here.&lt;/p&gt;
&lt;h2&gt;
  
  
  Heroku and is-https
&lt;/h2&gt;

&lt;p&gt;I am hosting app using &lt;code&gt;cloudflare&lt;/code&gt; for DNS and &lt;code&gt;heroku&lt;/code&gt; as a server. Pointing domain to heroku is done through &lt;code&gt;CNAME&lt;/code&gt;. Which is giving me some problems.&lt;br&gt;
Several modules of nuxt (sitemap, i18n) are using is-https library to identify on server side the type of request.&lt;br&gt;
The request which is done to cloudlfare is https, but probably that proxying is not.&lt;br&gt;
I got some &lt;a href="https://cmty.app/nuxt/sitemap-module/issues/c69" rel="noopener noreferrer"&gt;advices in CMTY&lt;/a&gt; on that.&lt;/p&gt;

&lt;p&gt;Enabling &lt;strong&gt;x-forwarded-proto&lt;/strong&gt; should help, but I didn't try it so far&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;code&gt;this&lt;/code&gt; everywhere
&lt;/h2&gt;

&lt;p&gt;Personally I like to write functional code in js. It is possible with nuxt but all the modules makes you use this.&lt;br&gt;
Want to get current locale in vuex store or in component? &lt;code&gt;this.app.i18n.locale&lt;/code&gt;&lt;br&gt;
THe same for switching locale and getting all locales list.&lt;br&gt;
Wnat to change page in Vuex? &lt;br&gt;
&lt;code&gt;this.router.push&lt;/code&gt;&lt;br&gt;
I can live with that, but having those objects as an arguments inside functions also could benefit for better code separation.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;code&gt;Rx.js&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;I love RX and love to apply it to especially state managing use cases.&lt;br&gt;
RX could be integrated to vue js and to nuxt as well, if we are talking about DOM events. There is this package:&lt;br&gt;
&lt;a href="https://github.com/vuejs/vue-rx" rel="noopener noreferrer"&gt;https://github.com/vuejs/vue-rx&lt;/a&gt;&lt;br&gt;
To integrate it to nuxt, just create a plugin like this:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Put this file into plugins folder and add the plugin in &lt;code&gt;nuxt.config.js&lt;/code&gt;. There were also couple of trials to integrate it into vuex, but so far repo is deprecated, and I haven't seen any articles regarding this in the late time.&lt;/p&gt;




&lt;h1&gt;
  
  
  Summarize
&lt;/h1&gt;

&lt;p&gt;All in all I love nuxt, I even prepared a workshop for my fellow colleagues and did it couple of times to spread the knowledge and encourage them to try it.&lt;br&gt;
I think it is a very mature and developed tool for any need. You could use it for everything starting from simple static landing, personal website, up to complex web application and ecommerce platform.&lt;br&gt;
I faced some caveats, which are feasible to fix, but also I had a lot of great moments, when everything so simple and works so awesome.&lt;br&gt;
I truly believe in that framework and deeply grateful to people that created it and are maintainig it till this very moment.&lt;br&gt;
&lt;strong&gt;Thank you, nuxt, nuxt :P&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>nuxt</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
