Worklog for task "Set meta tags"

12 июл. 2026 г., 22:17:37

There were many broken links, including those that were supposed to be internal, leading to random, already dead websites. Well, what can you do, the site was bought used, second-hand :-) So I had to add a content cleanup routine to the importer and re-import all the content.

export function cleanupImportingContent(
  content: string | undefined,
): string | undefined {
  if (!content) {
    return content
  }

  content = content.replaceAll('http://vietnamguru.ru/', '/')

  content = content.replaceAll('/city/hochiminh"', '/city/ho-chi-minh"')
  // /city/phan-thiet
  content = content.replaceAll(
    '/place/ho-chi-minh-museum"',
    '/place/ho-chi-minh-museum-phan-thiet"',
  )
  // /city/nha-trang
  content = content.replaceAll(
    '<a href="http://thaibase.ru/city/phatthaya">Паттайя</a>',
    'Pattaya',
  )

  // /city/phu-quoc
  content = content.replaceAll(
    '<a href="http://thaibase.ru/city/phuket">Пхукет</a>',
    'Phuket',
  )

  // /city/cam-ranh
  content = content.replaceAll('/beach/bai-dai"', '/place/bai-dai"')

  // /city/hai-phong
  content = content.replaceAll(
    '<a href="http://vietnow.ru/city/ha-noi">столицы</a>',
    '<a href="/city/ha-noi">Hanoi</a>',
  )
  // /city/hai-phong
  content = content.replaceAll(
    '<a href="http://vietnow.ru/city/ha-long">Халонг</a>',
    '<a href="/city/ha-long">Ha Long</a>',
  )

  // /city/bien-hoa
  content = content.replaceAll(
    '<a href="http://vietnow.ru/city/ho-chi-minh">Хошимин</a>',
    '<a href="/city/ho-chi-minh">Ho Chi Minh City</a>',
  )
  // /city/bien-hoa
  content = content.replaceAll(
    '<a href="http://airportguru.ru/airport/SGN">Таншоннят</a>',
    'Tan Son Nhat',
  )

  /**
   * Replacing all links, there seem to be a lot of them
   */
  content = content.replaceAll('http://vietnow.ru/', '/')

  content = content.replaceAll(
    '<iframe width="560" height="315" src="https://www.youtube.com/embed/TTTsp1_5-b4" frameborder="0" allowfullscreen></iframe>',
    '',
  )

  content = content.replaceAll(
    'Фото и видео произошедшего вы можете посмотреть пройдя по этой <a href="https://goo.gl/G5pk5P"target="_blank">ССЫЛКЕ</a>.',
    '',
  )

  content = content.replaceAll(
    '<iframe width="560" height="315" src="https://www.youtube.com/embed/ze0apK_iDnI" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>',
    '',
  )

  content = content.replaceAll(
    'Все подробности о проведении фестиваля можно узнать на <a href="http://www.huefestival.com/" target="_blank">официальном сайте мероприятия</a>.',
    '',
  )

  content = content.replaceAll(
    'Кафе находится по адресу <a href="https://goo.gl/maps/jrAuqWtUzrK2" target="_blank">23 Ngo Van So</a>.',
    '',
  )

  content = content.replaceAll(
    `Например, такой вариант:
http://www.ebay.com/itm/Bien-Hoa-Ceramics-Perfect-GuanYin-Statue-/382015625988`,
    '',
  )

  content = content.replaceAll(
    `Подробнее об апартаментах вы можете прочитать на странице 
<a href="http://vietnamguru.ru/blog/questions-apartments-villas-mui-ne" target="_blank">Часто задаваемые вопросы по апартаментам (1, 2 или 3 спальни) и виллам (3 спальни) в Муйне</a>`,
    '',
  )

  /**
   * In some places, links lacked spaces between attributes,
   * causing them to break. Therefore, we do two replacements.
   */
  content = content.replaceAll(' target="_blank"', '')
  content = content.replaceAll('target="_blank"', '')

  // /place/vinipearl-land-hon-tre-island

  return content
}

06.07.2026