Dnn.Platform
Dnn.Platform copied to clipboard
hreflang tags
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
Must have.
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.
Hey Stalebot, please do not close :)
Hi
Why have you closed this issue? I believe we still have this SEO problem.
Best Jose
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.
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!
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
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!
This bot is boring.
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...
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!
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.