Replies: 14 comments 26 replies
-
Great question! This was answered in discord but I am going to post it here too for visibility
When we have something tangible I will post it in this thread. |
Beta Was this translation helpful? Give feedback.
-
@Enigmatical - I think reliance on Next.js routing would be one of the big blockers of this at the moment using Tina Admin? Are there any other big pieces that would need to be changed so that Tina Admin could be dropped into a non-Next.js site? |
Beta Was this translation helpful? Give feedback.
-
Update 01/12/22Hey everyone 👋 , we have done some very early and very experimental/POC exploratory work for using Tina with static site generators like hugo. See the video below for what the final product looks like https://www.loom.com/share/d9227b079c954eef991060001527b02a First some caveats
OverviewTo achieve this we have 3 servers running
How it is doneThe code can be found here which contains two projects. (they could be separate) tina-adminThis is a simple react application build with vite that runs an admin interface for editing content. This admin interface can be hooked up to any TinaCMS graphQL server. In our case it will be a local server running in our huge-site. To start the admin dashboard the following command can be run (assuming the code is cloned onto a local computer) cd tina-admin
yarn install
yarn dev hugo-siteI used hugo in this example because of its popularity in forestry but the same ideas should be applied to any static site generator. In here you will also notice a So the {
"scripts": {
"dev": "yarn tinacms server:start -c\"hugo server -D\""
},
"dependencies": {
"@tinacms/cli": "^0.59.0"
} So if the following commands are run cd hugo-site
yarn install
yarn dev This will install all the TinaCMS CLI and run the TinaCMS server along side the hugo dev server Now we can edit the content on http://localhost:3000 and see the changes on the hugo dev server on http://localhost:1313 Further detailsIf anyone wants further instructions/questions feel free to replay to this thread or DM me in our community discord |
Beta Was this translation helpful? Give feedback.
-
Thanks for the helpful POC and video @logan-anderson ! I'm curious if people have thoughts on a good promoted pattern for deploying the admin. A few assumptions:
A few options I can think of: Monorepo setup:One sub-directory contains the Hugo site. It exports the schema, which gets consumed by another sub-package containing the admin. Monolithic setup:Let the user setup 2 deployments for the same repo, each with different build configurations. The Tina admin gets built into the Hugo site's
|
Beta Was this translation helpful? Give feedback.
-
EDIT: This has all been moved over to a guide: https://tina.io/guides/tinacms/non-react-based-ssg/guide/ ORIGINAL: I riffed off of @logan-anderson 's vite app POC, and added a little bit of a helper / guide for setting it up on an existing Hugo site. Also, I think there are lots of little things we could do to make this setup easier, but this should work for a basic MVP to get started. Full walkthrough: https://www.loom.com/share/1a50dbfb76b844d29eed27001d93a9c4 (MVP) Adding Tina to Hugo GuideTina Scaffolding SetupTo setup the tina scaffolding in your Hugo project... From within your Hugo root directory, run: npx hygen init repo tinalabs/ssg-admin Now we'll create the node configuration, to run the GraphQL API locally. Run: touch package.json enter the following values into the newly generated package.json: {
"name": "hugo-site",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "yarn tinacms server:start"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@tinacms/cli": "^0.60.11"
}
} Add the node_modules directory to the .gitignore echo "node_modules/" >> .gitignore Now you can install the new dependencies with yarn install Now let's test that the content api is running correctly by running yarn dev You should be able to browse the content api's dummy content, by going to: Running the Tina admin:Now, in a new tab, let's run the Tina admin locally with: cd tina-admin
yarn install
yarn dev You should from here be able to edit your site's content from the editor. For help using the editor, checkout our docs Note: To run this locally, you will need to be running the GraphQL server from the previous step. Model your contentOut of the box, there is a content model created for a "dummy-post". You will want to checkout Tina's content modelling docs, so that you can edit the content within your Hugo site. Deploying the adminStep 1) Push your repo to git Push your repo up to git, along its new tina configuration. Step 2) Setup a Tina Cloud project Checkout our Tina Cloud docs for help creating a Tina Cloud project Step 3) Connect the project ID In const clientId="<YOUR-TINA-PROJECT-ID-GOES-HERE>"
const branch = "<YOUR-BRANCH-HERE>" where Step 4) Build the admin for prod Build the site locally with cd tina-admin && yarn build This will output Tina's static admin page to the site's static directory. Once that is built, push everything up to git (including the new built admin) Step 5) Edit in production When everything has redeployed, you should be able to enter edit-mode at: __Note: Anytime your admin is updated, (E.g, changing the clientId or branch). you will need to rebuild it locally and re-push it to git). |
Beta Was this translation helpful? Give feedback.
-
I'm getting the following error upon clicking a collection:
I assume that this is because I have |
Beta Was this translation helpful? Give feedback.
-
Another little point, I can't get the Datetime type to work, |
Beta Was this translation helpful? Give feedback.
-
Just want to provide an update on this thread, as it's frequently asked in our Discord community: We are close to releasing an update to Tina that will allow it to natively work on non-React sites (in "CMS-only mode"). This guide will soon be phased out and replaced with the much more streamlined solution |
Beta Was this translation helpful? Give feedback.
-
I’m currently testing it out, but so far, using the discussion in this thread, I was able to get a basic Tina instance to work with Hexo, another SSG built in JS that is pretty similar to Hugo but not as popular. I can’t wait for the new release to come out. I also want to say thanks for making this super easy to figure out overall. I wanted a CMS for my blogs and found Tina only a few hours ago. |
Beta Was this translation helpful? Give feedback.
-
Hi, really looking forward to trying out Tina with Hugo in the new setup. Is there any PR I could track? Maybe I could help out with some beta testing or docs? |
Beta Was this translation helpful? Give feedback.
-
We've released a new |
Beta Was this translation helpful? Give feedback.
-
Hugo and other SSGs such as 11ty allow for .json files as data collections, great for things like menus or storing site settings. Forestry had beautiful support for this but so far in my experiments Tina seems to require |
Beta Was this translation helpful? Give feedback.
-
Hi, the The validation of markdown parser looks a bit more strict than it of forestry. Bodies of many articles returned parse errors. For example, they contain slash Also, I use Hugo's Page Resource which places image files relative to the markdown files for asset management. This is used for generating thumbnails of the images used in the article for each article. |
Beta Was this translation helpful? Give feedback.
-
Can we use tinacms build && hugo --minify in Github Action? |
Beta Was this translation helpful? Give feedback.
-
Hey Tina folks. I'm curious to know where we are with Hugo support. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions