static web app with Hugo and staticwebapp.config.json
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
I created a simple Hugo site and deployed it to Azure according to . Everything fine.
Then I created a Hugo section with some content:
~~~
.
├── archetypes
│ └── default.md
├── assets
├── content
│ ├── _index.md
│ ├── about
│ │ └── index.md
│ ├── authenticated
│ │ ├── _index.md
│ │ ├── another-post.md
│ │ └── my-second-post.md
│ └── post
│ ├── _index.md
│ ├── post-01.md
│ └── post-02.md
├── data
├── hugo.yaml
├── layouts
├── resources
├── static
│ └── staticwebapp.config.json
~~~
The `staticwebapp.config.json` looks like this:
~~~
{
"routes": [
{
"route": "/posts/*",
"allowedRoles": [ "anonymous" ]
},
{
"route": "/authenticated/*",
"allowedRoles": [ "authenticated" ]
}
]
}
~~~
When I push it to Github, everything works fine, except that the route `authenticated` is not protected. I guess that the `staticwebapp.config.json` file is ignored.
I I added the `config_file_location`line to the workflow file `.githug/workflows/azure-static-web-apps-...yml`:
~~~
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_JOLLY_BUSH_0E5700E03 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: "" # Api source code path - optional
config_file_location: "" # ADDED
output_location: "public" # Built app content directory - optional
###### End of Repository/Build Configurations ######
~~~
The build failed when I set `config_file_location` to public or ./, but it does nothing when I leave the line out or set it to empty.
**Expected behavior**
Routes are protected according to the `staticwebapp.config.json` definition.
**Device info (if applicable):**
- OS: OSX Darwin
- Browser safari
- hugo v0.117.0
**Additional context**
None
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.