Skip to content

Confused about relref when writing documents #24629

Closed
@wolfogre

Description

@wolfogre

I’m confused about how to use relref when writing documents, I'm sorry if I missed any guidance. But I want to clarify my confusions before I figure them out, this will help to understand a new contributor's confusion.

Let's say I'm a guy who:

  • know how to use hugo basically.
  • will copy existing examples if I don't know how to do it.
  • try to add/update docs for Gitea.

Some mistakes I made because of this:

And there are my confusions about relref:

I see two ways to link a page

I see both HTML style:

<a href='{{< relref "doc/administration/config-cheat-sheet.en-us.md" >}}'>configuration cheat sheet</a>

and markdown style:

Frontend development should follow [Guidelines for Frontend Development]({{< relref "doc/contributing/guidelines-frontend.en-us.md" >}})

However, the first one doesn't seem to be working.

image

When I'm writing x.zh-cn.md, I cannot link y.en-us.md

The error message will be REF_NOT_FOUND, like:

ERROR 2023/05/10 10:38:15 [zh-cn] REF_NOT_FOUND: Ref "doc/administration/config-cheat-sheet.en-us.md": "x/gitea/docs/content/doc/development/hacking-on-gitea.zh-cn.md:255:6": page not found

I was confused because the file does exist. After a few attempts, I understand now, I should use y.zh-cn.md instead, even if it doesn’t exist. And make docs will copy y.en-us.md to y.zh-cn.md, then it will work.

So the rule could be: when writing x.zh-cn.md, link to files with the suffix .zh-cn.md only, whether they exist or not. To be honest, I'm not sure if the rule is correct.

BTW, I think Hugo can do this better (I understand that there may be historical legacies that prevent us from doing so easily):

How to preview when writing

When I'm writing a document, I run cd docs && make server to preview the page. However, sometimes it fails with many REF_NOT_FOUND errors due to the reason mentioned earlier.

I know what to do: make docs && cd docs && make server. It works! I can go on writing happily. And when I'm done, OMG, I see hundreds of new files and get crazy trying to commit the files I wrote only carefully.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/docsThis PR mainly updates/creates documentationtype/questionIssue needs no code to be fixed, only a description on how to fix it yourself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions