ihp icon indicating copy to clipboard operation
ihp copied to clipboard

Sitemap instructions fails at parseRoute

Open kodeFant opened this issue 2 years ago • 5 comments

Hi!

Tried to follow the SEO guide at the IHP docs: https://ihp.digitallyinduced.com/Guide/seo.html

In FrontController.hs is fails with the following error message:

• Could not deduce (Controller SitemapController)
    arising from a use of ā€˜parseRoute’
  from the context: (?applicationContext::IHP.ApplicationContext.ApplicationContext,
                     ?application::WebApplication, ?context::RequestContext)
    bound by the type signature for:
               controllers :: forall controller.
                              (?applicationContext::IHP.ApplicationContext.ApplicationContext,
                               ?application::WebApplication, ?context::RequestContext) =>
                              [RouteParser]
    at /home/lillo/kode/kompak.ai/Web/FrontController.hs:14:5-15
• In the expression: parseRoute @SitemapController
  In the expression:
    [startPage WelcomeAction, parseRoute @SitemapController,
     parseRoute @StaticController, parseRoute @PostsController]
  In an equation for ā€˜controllers’:
      controllers
        = [startPage WelcomeAction, parseRoute @SitemapController,
           parseRoute @StaticController, ....]typecheck(-Wdeferred-type-errors)

kodeFant avatar May 12 '23 16:05 kodeFant

Likely an import Web.Controller.SitemapController is missing?

mpscholten avatar May 12 '23 17:05 mpscholten

Aha! Yes, that was it, thank you!

kodeFant avatar May 13 '23 15:05 kodeFant

Could you add the missing import to the docs?

mpscholten avatar May 13 '23 15:05 mpscholten

Will do!

I also noticed that if lastModified date is Nothing, it produces a self-closing </lastmod> which Google Search Console says is invalid. Should I try to fix this as well?

I suspect it's here

Where it should maybe return as a plain mempty instead of a <lastmod> element containing mempty

Here is the invalid result.

<urlset>
<url>
<loc>
http://localhost:8000/nyheter/velkommen-til-fremtidens-kommunikasjonspakke
</loc>
<lastmod>2023-05-08</lastmod>
<changefreq>hourly</changefreq>
</url>
<url>
<loc>
http://localhost:8000/nyheter/artikkel-her-med-fengende-tittel
</loc>
<lastmod>2023-05-09</lastmod>
<changefreq>hourly</changefreq>
</url>
<url>
<loc>http://localhost:8000/nyheter/roboter-er-kule</loc>
<lastmod>2023-05-09</lastmod>
<changefreq>hourly</changefreq>
</url>
<url>
<loc>http://localhost:8000/nyheter/tezter</loc>
<lastmod>2023-05-09</lastmod>
<changefreq>hourly</changefreq>
</url>
<url>
<loc>http://localhost:8000/nyheter/test</loc>
<lastmod>2023-05-09</lastmod>
<changefreq>hourly</changefreq>
</url>
<url>
<loc>http://localhost:8000/nyheter/hey-godamn</loc>
<lastmod>2023-05-09</lastmod>
<changefreq>hourly</changefreq>
</url>
<url>
<loc>https://kompak.ai</loc>
<lastmod/>
<changefreq>hourly</changefreq>
</url>
<url>
<loc>https://kompak.ai/nyheter</loc>
<lastmod/>
<changefreq>hourly</changefreq>
</url>
</urlset>

kodeFant avatar May 15 '23 12:05 kodeFant

Yes that sounds good šŸ‘ If possible, maybe you can also add a unit test for that

mpscholten avatar May 15 '23 15:05 mpscholten