Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support hreflang #20

Closed
hermesramos opened this issue Aug 7, 2019 · 3 comments
Closed

Support hreflang #20

hermesramos opened this issue Aug 7, 2019 · 3 comments

Comments

@hermesramos
Copy link

hermesramos commented Aug 7, 2019

More info: https://support.google.com/webmasters/answer/189077?hl=en

Thank you.

@ernado-x
Copy link
Owner

ernado-x commented Dec 3, 2021

Implemented in Release 2.5.1

@ernado-x ernado-x closed this as completed Dec 3, 2021
@ghost
Copy link

ghost commented Oct 5, 2022

@ernado-x, It is simply missing in 2.7.0 and master:

using System;
using System.Xml.Serialization;
using JetBrains.Annotations;

namespace X.Web.Sitemap;

[PublicAPI]
[Serializable]
[XmlRoot("url")]
[XmlType("url")]
public class Url
{
    [XmlElement("loc")]
    public string Location { get; set; }

    [XmlIgnore]
    public DateTime TimeStamp { get; set; }

    /// <summary>
    /// Please do not use this property to change last modification date. 
    /// Use TimeStamp instead.
    /// </summary>
    [XmlElement("lastmod")]
    public string LastMod
    {
        get => TimeStamp.ToString("yyyy-MM-ddTHH:mm:sszzz");
        set => TimeStamp = DateTime.Parse(value);
    }

    [XmlElement("changefreq")]
    public ChangeFrequency ChangeFrequency { get; set; }

    [XmlElement("priority")]
    public double Priority { get; set; }

    public Url()
    {
        Location = "";
    }

    public static Url CreateUrl(string location) => CreateUrl(location, DateTime.Now);

    public static Url CreateUrl(string url, DateTime timeStamp) =>
        new()
        {
            Location = url,
            ChangeFrequency = ChangeFrequency.Daily,
            Priority = 0.5d,
            TimeStamp = timeStamp,
        };
}

@ghost
Copy link

ghost commented Oct 5, 2022

a75b02b

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants