Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In v13 there is no startup.cs file #5952

Merged
merged 5 commits into from
Mar 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions 13/umbraco-cms/reference/content-delivery-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,17 @@ Video tutorial
This step is only applicable for Umbraco projects started on version 11 or below.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the steps below are only for projects below v11 as this hint states. Perhaps in this case it might be better to change the hint style="info" to hint style="warning" to make this more obvious?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that! I was just sparked by this forum post

https://our.umbraco.com/forum/using-umbraco-and-getting-started/113733-the-delivery-api-is-not-enabled-no-indexing-will-performed-for-the-delivery-api-content-index

so was thinking ahh, where have they seen the advice to update startup.cs... so I was looking specifically for the sample on the V13 version of the documentation, rather than reading it linearly... so I missed the 'hint'

I think we used to struggle with the balance of this with V6/v7/v8 docs - you want 'only' the information for the version that the person has selected in the docs, but sometimes there is very little change between the articles and also what about people who aren't using the latest version...

... with developer and documentation - often people are quickly searching/skimming a page for an answer, their time is precious, it's different to sitting down to read - the code sample is 'the gold' it's where attention is drawn to, the developer brain understands the code better than the description (well not all devs, we all consume and learn differently)

Anyway, I think that is the trap the person in the forum fell into and I followed...

But what do we do for 'V12 and below users' who are accidentally visiting the V13 page documentation? when they haven't adopted V13 yet? and for how long do we support that journey as 'the default' given V13 is the LTS.

I think you could put the additional legacy information inside an accordion? now that we can do that in the docs??

so you'd have

Register the Content Delivery API Dependencies

For V13, and above the Content Delivery API Dependencies are automatically registered via .AddDeliveryApi() in the solution's project.cs File

For V12 and Below [v]

(this is the bit inside the accordion and describes the steps for registering dependencies in startup.cs)

This way nobody is accidentally drawn to the code sample, but you are still supporting the swathes of people who haven't adopted V13 yet - also when you come to edit this page for V17 LTS, you can think ok, we can remove this accordion now, and it's much easier to see what needs to be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is a really good idea! So below this text "Umbraco projects started on version 11 or below also need to opt-in through code by registering the delivery API dependencies. Below you will find a description of how to do this." add accordion with the steps under "Register the Content Delivery API dependencies for v12 or below". 👍

Would you be up for making this change or would you prefer me to do it asap? 😊

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI Alina - I don't know how to do the magic accordion markup!!!

feel free to tweak and I can observe, or I may get chance over the weekend to have a look.

regards

Marc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Marc, you can find an example here: https://github.com/umbraco/UmbracoDocs/blob/main/14/umbraco-cms/tutorials/creating-a-property-editor/adding-configuration-to-a-property-editor.md?plain=1. Where it is written “see the entire file”

Shortly it needs the details and summary tags as per the gitbook docs (gitbook being the platform we use for our docs) https://docs.gitbook.com/content-editor/blocks/expandable

You can give it a try if you have some time and then I can review and help along the way 😊

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alina-tincas done! (I think) hopefully correctly...

firstly I moved any mention of this step to be below the video, I figure for most people moving forwards, the topic is introduced the video is there...

... for people looking at the exact steps, will then see the accordion

I've tweaked the order of the text, as we read from left to right, so the very first bit of the accordion title is 'For Version 12 and below ONLY' - this makes it easier for the reader to skip this entirely, whereas if they are skimming they may not get to the end of the bit about it being V12 only, before expanding the accordion...

I'm not sure if I'm meant to be able to see the result somewhere! but hopefully this gives you something to work with!

regards

marc

{% endhint %}

1. Open your project's `Startup.cs` file and locate the `ConfigureServices` method.
1. Open your project's `program.cs`
2. Register the API dependencies by adding `.AddDeliveryApi()`:

```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddUmbraco(_env, _config)
.AddBackOffice()
.AddWebsite()
// Register all Delivery API dependencies
.AddDeliveryApi()
.AddComposers()
.Build();
}
builder.CreateUmbracoBuilder()
.AddBackOffice()
.AddWebsite()
//add delivery API magic here:
.AddDeliveryApi()
.AddComposers()
.Build();
```

### Enable the Content Delivery API
Expand Down
Loading