poblabs / weewx-belchertown

A clean and modern weewx skin with real time streaming updates, forecast data and interactive charts. View it in action at BelchertownWeather.com
https://belchertownweather.com
GNU General Public License v3.0
208 stars 111 forks source link

canonical doesn't change on others pages #847

Closed norecords closed 1 year ago

norecords commented 1 year ago

Hi there, there is a canonical url problem.

https://github.com/poblabs/weewx-belchertown/blob/bc1614642ed7d5f45705f7fc22e8dab93eaab966/skins/Belchertown/header.html.tmpl#L59-L61

I suggest to change for

        #if $station.station_url and $page == "home"
        <link rel="canonical" href="$station.station_url" />
        #elif $station.station_url and $page != "home"
        <link rel="canonical" href="$station.station_url/$page" />
        #end if

and add #set global $page = "NAME_OF_PAGE" to every pages.

roe-dl commented 1 year ago

and add #set global $page = "NAME_OF_PAGE" to every pages.

There is no need to do so, as WeeWX sets $page to the name of the actual page.

roe-dl commented 1 year ago

I did it that way:

        #if $station.station_url
        #set $canonical_url = ($station.station_url+"/"+$filename).replace("/index.html","/")
        <link rel="canonical" href="$canonical_url" />
        #end if

$filename is set by WeeWX.

norecords commented 1 year ago

@roe-dl can you add this to a pull request, I think it should be fixed before next release!

roe-dl commented 1 year ago

Done. #848

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

norecords commented 1 year ago

That have been merge in 1.3 release