Skip to content

Commit

Permalink
Redirect uppercase doc urls
Browse files Browse the repository at this point in the history
they were returning 404
  • Loading branch information
pfreitag committed Sep 13, 2024
1 parent 5e36a01 commit 74ddbac
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions doc.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
<cfset request.gitFilePath = "/edit/master/data/en/" & url.name & ".json">
<cfset request.canonical_url = "https://cfdocs.org/#lcase(url.name)#">
<cfelse>
<cfset url.name = ReReplace(url.name, "[^a-zA-Z0-9._-]", "", "ALL")>
<cfset url.name = ReReplace(url.name, "[^a-zA-Z0-9_-]", "", "ALL")>
<cfif reFind("[A-Z]", url.name)>
<cfif FileExists(ExpandPath("./data/en/#lCase(url.name)#.json")) OR FileExists(ExpandPath("./guides/en/#lCase(url.name)#.md"))>
<cflocation url="https://cfdocs.org/#lcase(url.name)#" addtoken="false" statuscode="301">
</cfif>
</cfif>
<cfset possible = []>
<cfloop array="#application.index.functions#" index="i">
<cfif Len(url.name) LTE 3>
Expand All @@ -40,7 +45,7 @@
</cfloop>
<cfset data = {
name = url.name,
description = "Sorry we don't have any docs matching that name. If we should have a doc for this, please log an <a href=""https://github.com/foundeo/cfdocs/issues/new"">Issue</a> so we can look into it. You can easily access functions and tags using an url like <a href=""http://cfdocs.org/hash"">cfdocs.org/hash</a>. Just hit <code>/tag-name</code> or <code>/function-name</code> or use the search box above.",
description = "Sorry we don't have any docs matching that name. If we should have a doc for this, please log an <a href=""https://github.com/foundeo/cfdocs/issues/new"">Issue</a> so we can look into it. You can easily access functions and tags using an url like <a href=""https://cfdocs.org/hash"">cfdocs.org/hash</a>. Just hit <code>/tag-name</code> or <code>/function-name</code> or use the search box above.",
type = "404",
related = possible
}>
Expand Down

0 comments on commit 74ddbac

Please sign in to comment.