# HTML export changes order of events

**URL:** <https://gramps.discourse.group/t/html-export-changes-order-of-events/6375>\
**Category:** Help\
**Created:** [November 3, 2024, 5:00pm UTC](https://gramps.discourse.group/t/html-export-changes-order-of-events/6375 "2024-11-03T17:00:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ursus](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/ursus/32/5975_2.png) [@ursus](https://gramps.discourse.group/u/ursus)\
**Post date:** [November 3, 2024, 5:00pm UTC](https://gramps.discourse.group/t/html-export-changes-order-of-events/6375/1 "2024-11-03T17:00:31Z")

</div>

AIO64-5.2.3-r1-aa03f5a  
WIN 11

Within Gramps I have sorted my events the way I need them to be sorted. However when exporting through ‘Website with a story’ the sorting gets mangled. Why would the sorting be changed from what I have entered?

example:  
Event: Education, Date From 1959 to 1960, Location: School at a place  
Event below: Residency, date 1960, Location: at a different place

I need this info to remain in the order I have added it. However the html export swaps them around (and does so for several other events as well). Why does it do that and what can I do to prevent that from happening. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [November 3, 2024, 8:45pm UTC](https://gramps.discourse.group/t/html-export-changes-order-of-events/6375/2 "2024-11-03T20:45:30Z")

</div>

> [@ursus](#):
>
> Within Gramps I have sorted my events the way I need them to be sorted. However when exporting through ‘Website with a story’ the sorting gets mangled. Why would the sorting be changed from what I have entered?

That could be either of a couple reasons:

1. the events might be in creation order, not override sort order
2. it might be the an artifact related to Events potentially being collated from multiple sources and then being reduced to a `unique` list. So the order override becomes unusable

I think it would helpful to have a sample that others can reproduce. Usually, developers prefer that samples be based on the [`example.gramps`](https://gramps-project.org/wiki/index.php/Example.gramps) tree.

---

<div class="post-metadata">

**Author:** ![DaveSch](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesch/32/40_2.png) [@DaveSch](https://gramps.discourse.group/u/DaveSch)\
**Post date:** [November 3, 2024, 11:51pm UTC](https://gramps.discourse.group/t/html-export-changes-order-of-events/6375/3 "2024-11-03T23:51:27Z")

</div>

I just did a test by switching the order of my father’s military service events, When I created the [Narrated Web](https://gramps-project.org/wiki/index.php/Gramps_5.2_Wiki_Manual_-_Reports_-_part_7#Narrated_Web_Site), the events were in date order. But whatever code is putting the events in date order, it is leaving an event like Burial with no date as the last event in the list, The code is doing the sort smartly unlike the [Sort Events](https://gramps-project.org/wiki/index.php/Gramps_5.0_Wiki_Manual_-_Tools#Sort_Events) tool that placed any non-dated events as the first events.

I also did a specific test using `from 1959 to 1960` as the first event and `1960` as the second event. The single event of `1960` was sorted in the report before the `from 1959 to 1960` event. A second test of `from 1953 to 1960` and the second event dated `1960`, the 1960 event was sorted first in the report and the `from 1953 to 1960` event followed. The last test was `from 1953 to 1961` and `1960` with the same results.

I suspect the event sort is using `<date2>` in a `from <date1> to <date2>` and a `between <date1> and <date2>` scenario.

More testing is needed and a closer look at the code.

---

<div class="post-metadata">

**Author:** ![ursus](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/ursus/32/5975_2.png) [@ursus](https://gramps.discourse.group/u/ursus)\
**Post date:** [November 4, 2024, 4:40pm UTC](https://gramps.discourse.group/t/html-export-changes-order-of-events/6375/4 "2024-11-04T16:40:10Z")

</div>

Thanks Dave for trying that and giving that example. It is exactly what has happened with my Narrated export. So I won’t be needing to make my own I guess. Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [December 4, 2024, 4:40pm UTC](https://gramps.discourse.group/t/html-export-changes-order-of-events/6375/5 "2024-12-04T16:40:13Z")

</div>

Closed on December 4, 2024, 4:40pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
