def shorten_duplicate_content_url(url):
    """Remove anchor part and trailing index.html from URL."""
    if '#' in url:
        url = url.split('#', 1)[0]
    if url.endswith('index.html'):
        return url[:-10]
    if url.endswith('index.htm'):
        return url[:-9]
    return url