# Topic "popular links" panel domain extraction doesn't handle country TLDs

**URL:** <https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156>\
**Category:** Bug\
**Created:** [March 30, 2017, 4:32am UTC](https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156 "2017-03-30T04:32:15Z")\
**Posts on this page:** 1\
**Showing post:** 24

<div class="post-metadata">

**Author:** ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)\
**Post date:** [March 31, 2017, 11:42pm UTC](https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156/24 "2017-03-31T23:42:26Z")

</div>

The problem here is that there is no good length that we can use to get all the cases right.

Let’s take `www.city.amakusa.kumamoto.jp` for example,

The right output we should get is

> Where does this go? city.amakusa.kumamoto.jp

Note that just displaying `amakusa.kumamoto.jp` or `kumamoto.jp` is incorrect here because it is as good as displaying `com.au` where we don’t provide any indication of where the site is going.

Assuming we determine that 7 chars is a good length, the heuristic algorithm will only produce `kumamoto.jp` which is not what we want. Just to get this case right, the `length` that we use will have to be `17` chars excluding the periods and we have to start considering the number of periods in the domain. If we bump the number of chars too much, we’ll end up displaying the full domain like `community.seqta.com.au` which brings us back to square one.

---

_[View the full topic](https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156)._
