Answers.Body: <p>Andrea's answer is part of the solution!</p>
  <p>You'll need to set up a route, either via <code>routes.php</code>, or via the admin. I tend to prefer PHP routes, so you never have to worry about the functionality being removed from the app due to actions in the CP.</p>
  <pre><code>return [
      'my/path/&lt;entrySlug:{slug}&gt;' =&gt; ['template' =&gt; '_my/path/edit-entry']
  ];
  </code></pre>
  <p>Create a form in <code>templates/_my/path/edit-entry</code> that contains all the fields you want a user to be able to edit.</p>
  <blockquote>
  <p>Keep in mind that <em>this doesn't actually restrict which fields they can update</em>, but you don't have to display everything, if you don't want or need to. The only way to <a href="https://putyourlightson.com/articles/securing-front-end-user-profile-and-entry-forms-in-craft" rel="nofollow noreferrer">control which fields are updatable</a> (Ben Croker, PutYourLightsOn, 2021-05-04) is via a custom module/plugin controller.</p>
  </blockquote>
  <p>The edit page should include, at minimum:</p>
  <pre><code>{# Find the entry by slug and author: #}
  {% set entry = craft.entries({
      slug: entrySlug,
      authorId: currentUser.id
  }).one() %}
  
  {# If the entry wasn't found, or didn't belong to the current user, throw up the 404 page: #}
  {% unless entry %}
      {% exit 404 %}
  {% endunless %}
  
  {# Create a small form with your attributes: #}
  &lt;form method=&quot;post&quot;&gt;
      {{ csrfInput() }}
      &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&gt;
  
      &lt;input type=&quot;text&quot; name=&quot;title&quot; value=&quot;{{ entry.title }}&quot;&gt;
      &lt;input type=&quot;text&quot; name=&quot;fields[myFieldHandle]&quot; value=&quot;{{ entry.myFieldHandle }}&quot;&gt;
  &lt;/form&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T06:25:26.313Z
Answers.LastActivityDate: 2021-10-22T18:30:09.533Z
Answers.LastEditDate: 2021-10-22T18:30:09.533Z
Answers.UserDisplayName: August Miller
Answers.Body: <p>In my <code>_entry.html</code> (or <code>_entry.twig</code>), I have the following:</p>
  
  <p><code>&lt;a href="{{ entry.url }}/edit"&gt;Edit entry&lt;/a&gt;</code></p>
  
  <p>This would look like: <a href="http://example.com/my-section/my-entry/edit" rel="nofollow noreferrer">http://example.com/my-section/my-entry/edit</a></p>
  
  <p>EDIT:</p>
  
  <p><code>&lt;a href="{{ url(entry.url ~ '/edit') }}"&gt;Edit entry&lt;/a&gt;</code> may be considered a better practice.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T01:22:43.470Z
Answers.Text: This comes with `/edit` template not found? Where do you place your template for edit?
Answers.UserDisplayName: JMKelley
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T01:26:56.710Z
Answers.Text: or do you create a route allowing each entry to be edited?
Answers.UserDisplayName: JMKelley
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T21:00:55.463Z
Answers.Text: I have a folder for my section called "Blog", and in blog I have my _entry & edit templates. Also a route shown in screenshot: https://cl.ly/5ef8e668052a
Answers.UserDisplayName: Andrea DeMers
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T00:55:40.543Z
Answers.LastActivityDate: 2018-11-28T01:05:20.537Z
Answers.LastEditDate: 2018-11-28T01:05:20.537Z
Answers.UserDisplayName: Andrea DeMers
Body: <p>I currently have a freeform which allows logged in users to create an entry from the front end. I'm looking to build an edit page for each of these entry's so the user can come back and edit it if they've made a mistake.</p>
  
  <p>I'm getting confused on how to do this on a per entry basis. e.g. how do I make a link on the front end for each entry that links to it's own <code>/entry_slug/edit</code>?</p>
  
Tags: <templating><users>
Title: Edit Entry Page
ThreadText: # Edit Entry Page
  
  (Asked by: username_0 on 2018-11-28)
  
  I currently have a freeform which allows logged in users to create an entry from the front end. I'm looking to build an edit page for each of these entry's so the user can come back and edit it if they've made a mistake.
  
  I'm getting confused on how to do this on a per entry basis. e.g. how do I make a link on the front end for each entry that links to it's own `/entry_slug/edit`?
  
  **Tags:** templating, users
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-11-28. Score: 3 | Accepted answer
  
  username_2's answer is part of the solution!
  
  You'll need to set up a route, either via `routes.php`, or via the admin. I tend to prefer PHP routes, so you never have to worry about the functionality being removed from the app due to actions in the CP.
  
  ```
  return [
      'my/path/<entrySlug:{slug}>' => ['template' => '_my/path/edit-entry']
  ];
  
  ```
  
  Create a form in `templates/_my/path/edit-entry` that contains all the fields you want a user to be able to edit.
  
  > Keep in mind that *this doesn't actually restrict which fields they can update*, but you don't have to display everything, if you don't want or need to. The only way to [control which fields are updatable](https://putyourlightson.com/articles/securing-front-end-user-profile-and-entry-forms-in-craft) (Ben Croker, PutYourLightsOn, 2021-05-04) is via a custom module/plugin controller.
  
  The edit page should include, at minimum:
  
  ```
  {# Find the entry by slug and author: #}
  {% set entry = craft.entries({
      slug: entrySlug,
      authorId: currentUser.id
  }).one() %}
  
  {# If the entry wasn't found, or didn't belong to the current user, throw up the 404 page: #}
  {% unless entry %}
      {% exit 404 %}
  {% endunless %}
  
  {# Create a small form with your attributes: #}
  <form method="post">
      {{ csrfInput() }}
      <input type="hidden" name="action" value="entries/save-entry">
      <input type="hidden" name="entryId" value="{{ entry.id }}">
  
      <input type="text" name="title" value="{{ entry.title }}">
      <input type="text" name="fields[myFieldHandle]" value="{{ entry.myFieldHandle }}">
  </form>
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2018-11-28. Score: 2
  
  In my `_entry.html` (or `_entry.twig`), I have the following:
  
  `<a href="{{ entry.url }}/edit">Edit entry</a>`
  
  This would look like: <http://example.com/my-section/my-entry/edit>
  
  EDIT:
  
  `<a href="{{ url(entry.url ~ '/edit') }}">Edit entry</a>` may be considered a better practice.
  
  > **Comments:**
  > **username_0**: This comes with `/edit` template not found? Where do you place your template for edit?  
  > **username_0**: or do you create a route allowing each entry to be edited?  
  > **username_2**: I have a folder for my section called "Blog", and in blog I have my _entry & edit templates. Also a route shown in screenshot: https://cl.ly/5ef8e668052a  
  
  ---
  
  