Research Best Practices on Accessing Source Content from Hugo #7840
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This is just a proof of concept, not to merge.
Using Hugo JSON endpoints as a migration source for a Drupal migration.
Solution
It shows how we can use JSON endpoints provided by HUGO to be the source data for a Drupal migration.
The corresponding code in Drupal that does the migrating is stored here GSA/digital-gov-drupal#1.
This shows that you can expose the images in Hugo and migrate them into Drupal. We should be able to do this for all the content we need rather than attempting to parse .md files.
How To Test
1a. You already have the Drupal environment checked out locally: move into it in your terminal
1b. You have not worked with the Drupal environment yet:
git clone git@github.com:GSA/digital-gov-drupal.git && cd digital-gov-drupal
2. Checkout the feature branch:
git checkout feature/migrate-image-example
3a. If you have not worked with the Drupal environment yet, see the documentation.
3b. If you have worked with the Drupal environment already:
lando start && lando si
4. Enable the migration scripts and run the migration:
./drush.sh en -y digital_gov_migration && ./drush.sh migrate:import json_images
(See 'Notes' below about the errors you'll see)5. Login to Drupal:
./drush.sh uli
6. The files migrated from Hugo can be seen at http://digitalgov.lndo.site/admin/content/files
Notes
There are 9 images that 403 during the migration. You can see which ones with
./drush.sh migrate:messages json_images
or in the document titledDigital.gov missing images
in the shared drive.