# The correct way to add pages by code

**URL:** <https://forum.litium.com/t/the-correct-way-to-add-pages-by-code/1398>\
**Category:** Questions\
**Created:** [March 23, 2020, 10:44am UTC](https://forum.litium.com/t/the-correct-way-to-add-pages-by-code/1398 "2020-03-23T10:44:56Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [March 24, 2020, 10:04am UTC](https://forum.litium.com/t/the-correct-way-to-add-pages-by-code/1398/3 "2020-03-24T10:04:52Z")

</div>

In order for back office to have the same content from the changes you made in code, a good idea is to make the changes to a DraftPage of the new page you created and then publish that one.

```auto
var draftPage = _draftPageService.Get(page.SystemId).MakeWritableClone();
// make changes
_draftPageService.Update(draftPage);
_draftPageService.Publish(draftPage);

```

---

_[View the full topic](https://forum.litium.com/t/the-correct-way-to-add-pages-by-code/1398)._
