WordPress.org

Ready to get started?Download WordPress

Forums

Danish accents, remove_accents() and permalinks (4 posts)

  1. pbs74
    Member
    Posted 2 years ago #

    Hi

    I'd like to switch permalink format from the standard ?p=1234 to using %postname% for SEO reasons.

    My site is in Danish, and thus post titles have Danish accents, i.e., æ, ø, and å.

    Out of the box, setting permalinks to &postname% will generate post slugs by substituting "æ", "ø", and "å" with "ae", "o", and "a" rather than the - in Danish - well understood and expected "ae", "oe", and "aa".

    From a SEO point of view I'd like the latter, since Google will understand those substitutions, and have the url part count as well As an example, searching for "øl" (which is beer in Danish) will highlight urls with oel in the url as well, but not urls with ol, which would be the case out-of-the-box.

    Now, I've figured out that the accent handling is done in the remove_accent() method in the formatting.php function, and I have remapped the values so ø => oe, and å => aa.

    This works when creating new posts, suggesting the expected slug.

    However, I have quite a lot of existing posts and when switching the permalink structure from %postid" to %postname% this seems to only substitute æ to ae in slugs for the existing posts, i.e., same behavior as in the out-of-box remove_accent() method.

    What do I need to do to get what I want wrt generating slugs for existing posts?

    Also, do anyone know the rationale for just stripping the umlauts/accents in ø and å, rather than convert them to oe and aa out of the box?

    Thanks,
    Peter

  2. RichardWPG
    Member
    Posted 2 years ago #

  3. pbs74
    Member
    Posted 2 years ago #

    Thanks

    I read the permalink codex page prior to posting along with those on remove_accent() and sanitize_title(), but could not find anything answering above.

    I've re-read the permalink page after your link, and still cannot see it answering above, maybe I am missing something - can you point me to the specific part of the codex page you think addresses my issues?

  4. Pavel Petrov
    Member
    Posted 1 year ago #

    Here is an implementation of using accents in permalinks which will do the trick. You just have to replace the swedish accented characters with the danish ones. If youre having any trouble let me know(and provide me all the characters you need) and Ill do that for you.

Topic Closed

This topic has been closed to new replies.

About this Topic