1

I'm using drupal 8 and Pathauto.

I have title of the type (in French) Personnes d'Allemagne, I would like to delete d' to have like url personnes-allemagne.

Pathauto removes the apostrophes well, but preserves the particle before, which gives people-dallemagne.

I tried to add in the words to delete d' or just d, but it does not work. Pathauto continues to delete only the apostrophe and not the d.

I thought of replacing the apostrophe with a dash, but I would prefer to delete particle and dash.

Someone has a solution?

2

I have been able to achieve it with the Pathauto module 8.x-1.3, using the following settings (/admin/config/search/path/settings).

  • For Strings to Remove I used a, an, as, at, before, but, by, for, from, is, in, into, like, of, off, on, onto, per, since, than, the, this, that, to, up, via, with, d'

  • Under Punctuation, for Single quotation marks (apostrophe) ('), I selected No action (do not replace)

I used /content/[node:nid]/[node:title] as pattern for the nodes, and created a node with Personnes d'Allemagne as title. The path alias for that node has been set to /content/1/personnes-allemagne.

screenshot

The disadvantage is that the apostrophe will not taken off from the path aliases, except when it is present in a string given for the Strings to Remove setting.

1

The punctuation processing is done before the words processing/replacements and Kiamlaluno's answer would be my solution too.

Just wanted to point out that if you want to reenable the apostrophe stripping but still keep the d' stripping you can do so in a custom module

function MODULENAME_pathauto_alias_alter(&$alias, array &$context) {
  $alias = str_replace("'","",$alias);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.