Automating Google Sites: What Worked, What Failed, and What Cost a Rebuild
Описание и применение
Автоматизация публикации в Google Sites без официального API: единственный надёжный способ – имитировать ввод клавиш через расширение браузера, учитывая проблемы с не‑ASCII символами, списками, ссылками, заголовками и изображениями.
Задача
Automating content publishing into Google Sites without an official API, ensuring persistence across reloads and handling editor quirks.
Результат
The only reliable method was synthetic keystrokes via a browser automation extension, with careful handling of non‑ASCII, list formatting, links, headings, and image placement. This approach survived reloads and produced a stable Google Sites page.
Рабочий процесс
- 1. Verify editor uses internal document model by mutating DOM and reloading to confirm loss.
- 2. Test synthetic keystrokes via browser automation extension; ensure non‑ASCII characters are normalized to ASCII.
- 3. Avoid leading '- ' to prevent retroactive list formatting; if triggered, select all and toggle list button twice.
- 4. For hyperlinks, select anchor text, press cmd+k, click URL input, then click Apply via synthetic click events; avoid pressing Enter inside URL input.
- 5. Insert headings using cmd+alt+2 or cmd+alt+3 with ~3s pause between commands.
- 6. Upload images via file input; if crash occurs, handle manually or use separate layout block.
- 7. Duplicate root page to subpage to preserve title tag; set custom path in duplicate dialog.
- 8. After each change, reload to confirm autosave persisted.
- 9. Compile final page and publish.
Доказательства
The only approach that updates the document model and survives a reload is sending synthetic keystrokes through a browser automation extension.
Typing, character by character, through the extension works, and persists.
- Дата записи: 2026-09-15T13:00:48.829Z