Skip to content
This repository was archived by the owner on Mar 10, 2021. It is now read-only.

Slugify and replace space with hyphens in page path#74

Closed
manusajith wants to merge 1 commit intoinfinitered:masterfrom
manusajith:master
Closed

Slugify and replace space with hyphens in page path#74
manusajith wants to merge 1 commit intoinfinitered:masterfrom
manusajith:master

Conversation

@manusajith
Copy link
Copy Markdown
Contributor

Ref: #67

This change replaces spaces in slug with hyphens, but the bug still remains, as the redirection is handled in the front end now. We should either update backend to return the updated changeset or should update frontend with the same logic to replace spaces with hyphens

Signed-off-by: Manu S Ajith <neo@codingarena.in>
@yulolimum
Copy link
Copy Markdown
Member

@jamonholmgren

@jamonholmgren
Copy link
Copy Markdown
Member

@manusajith I missed this, sorry about that!

We already have some code to handle slugification, so we should unify the two:

defp parameterize(str) do
str = Regex.replace(~r/[^a-z0-9\-\s]/i, str, "")
Regex.split(~r/\%20|\s/, str)
|> Enum.join("-")
|> String.downcase
end

Otherwise, 👍 on this change.

Could you also write a test or two?

@jamonholmgren
Copy link
Copy Markdown
Member

@robinheinze and/or @mlaco Let's chat about this at some point.

@silasjmatson
Copy link
Copy Markdown
Contributor

Closing in favor of #111

Thanks for the help, @manusajith!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants