Dnn.Platform icon indicating copy to clipboard operation
Dnn.Platform copied to clipboard

hreflang tags

Open Tychodewaard opened this issue 5 years ago • 11 comments

Description of problem

If you have multiple languages in a website, Google expects to have hreflang tags applied in the website.

Description of solution

Every page that is multilingual should have a correct hreflang be present in the head as described in (https://support.google.com/webmasters/answer/189077?hl=en).

Description of alternatives considered

There is no alternative.

Affected version

all

Affected browser

N/A

Tychodewaard avatar May 26 '19 06:05 Tychodewaard

Must have.

roman-yagodin avatar Jun 19 '19 06:06 roman-yagodin

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.

stale[bot] avatar Oct 04 '19 03:10 stale[bot]

Hey Stalebot, please do not close :)

valadas avatar Oct 05 '19 05:10 valadas

Hi

Why have you closed this issue? I believe we still have this SEO problem.

Best Jose

jac69 avatar Jul 30 '21 14:07 jac69

Due to branching changes, we will replay this against the release 10 branch once it is created, No action needed by submitter at this time.

mitchelsellers avatar Aug 31 '21 19:08 mitchelsellers

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

stale[bot] avatar Jan 09 '22 01:01 stale[bot]

Still relevant - very important for multilang sites.

Temporary solution

Inject hreflang into the html header until this issue is resolved:

`

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    // Temporary solution: provides html hreflang until sitemap fixed in DNN 10 (?) -> https://github.com/dnnsoftware/Dnn.Platform/issues/2819
    var smProv = new DotNetNuke.Services.Sitemap.CoreSitemapProvider();
    var smUrls = new List<DotNetNuke.Services.Sitemap.SitemapUrl>();
    try
    {
        smUrls = smProv.GetUrls(PortalSettings.PortalId, PortalSettings, "0.9");
        foreach (DotNetNuke.Services.Sitemap.SitemapUrl url in smUrls)
        {
            if (url.Url == Request.Url.Scheme + "://" + Request.Url.Authority + Request.RawUrl)
            {
                foreach (DotNetNuke.Services.Sitemap.AlternateUrl alt in url.AlternateUrls)
                {
                    AttachCustomHeader("<link rel='alternate' hreflang='" + alt.Language.Substring(0,2) + "' href='" + alt.Url + "' />");
                }
            }
        }
    }
    catch
    {
    }

protected void AttachCustomHeader(string CustomHeader) { HtmlHead HtmlHead = (HtmlHead)Page.FindControl("Head"); if ((HtmlHead != null)) { HtmlHead.Controls.Add(new LiteralControl(CustomHeader)); } }

`

See it in action: https://www.wiremayr.com

Navilois avatar Jan 11 '22 10:01 Navilois

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

stale[bot] avatar Apr 16 '22 07:04 stale[bot]

This bot is boring.

jac69 avatar Apr 16 '22 21:04 jac69

This bot was introduced to help with triage. Issues that have no activity for some time are marked to try and catch some attention for a contribution. Comments like this one only make the bot useless and clutter the backlog. This issue has been here for almost 3 years now and nobody contributed either in code or financially to someone who can work on making that code happen. @Navilois can you make your code comment a PR please, this would be awesome...

valadas avatar Apr 17 '22 05:04 valadas

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

stale[bot] avatar Jul 31 '22 03:07 stale[bot]

This issue has been closed automatically due to inactivity (as mentioned 14 days ago). Feel free to re-open the issue if you believe it is still relevant.

stale[bot] avatar Nov 02 '22 03:11 stale[bot]