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

"Improve this Document" link not appearing for Gitlabs. #1144

Closed
d96patel opened this issue Jan 10, 2017 · 8 comments
Closed

"Improve this Document" link not appearing for Gitlabs. #1144

d96patel opened this issue Jan 10, 2017 · 8 comments

Comments

@d96patel
Copy link

I am working on a documentation project for GitLabs hosted project.
URL format is https://git.companyname.com
How to make the link work?

part of docfx.json is as shown below.

"globalMetadata": {
"_enableSearch": "true",
"_gitContribute": {
"repo": "https://git.companyname.com/dev/Development.git",
"branch": "master",
"path": ""
},
"newFileRepository": {
"branch": "master"
}
},

@superyyrrzz
Copy link
Contributor

I found GitLab has the same URL pattern with GitHub, you can try adding "_gitUrlPattern": "github" in global metadata.
see: #677 (comment)

@d96patel
Copy link
Author

d96patel commented Jan 11, 2017

@superyyrrzz thanks for the prompt reply. I tried that as well but it does not work.
I am using NuGet version 2.4.0 in VS 2015.
FYI: I am implementing this on a local branch and not on a master branch.
Below is a docfx.json for your reference.


{
  "metadata": [
    {
      "src": [
        {
          "files": [
            "Folder/**.csproj",	
          ],
          "exclude": [
            "**/obj/**",
            "**/bin/**",
            "_site/**",
          ],
          "src": "../"
        }
      ],
      "dest": "api"
    }
  ],
  "build": {
    "content": [
      {
        "files": [
          "api/**.yml",
          "api/index.md"
        ]
      },
      {
        "files": [
          "articles/**.md",
          "articles/**/toc.yml",
          "toc.yml",
          "*.md"
        ],
        "exclude": [
          "obj/**",
          "_site/**"
        ]
      }
    ],
    "dest": "_site",
    "globalMetadata": {
      "_enableSearch": "true",
      "_gitContribute": {
        "repo": "https://git.mycompany.com/dev/Development.git",
        "branch": "master",
        "path": ""
      },
      "_gitUrlPattern": "github",
      "newFileRepository": {
        "branch": "master"
      }
    },
    "overwrite": [
      {
        "files": [
          "apidoc/**.md"
        ],
        "exclude": [
          "obj/**",
          "_site/**"
        ]
      }
    ],
    "resource": [
      {
        "files": [
          "images/**"
        ],
        "exclude": [
          "obj/**",
          "_site/**"
        ]
      }
    ],
    "template": [
      "default"
    ]
  }
}

@superyyrrzz
Copy link
Contributor

I think your docfx.json is right, and local branch is also OK. Here're some other steps that may help narrow down the problem.

  1. What version of DocFX do you use? _gitUrlPattern is supported since 2.5.1
  2. Can you try remove _gitContribute to see whether the result right?
  3. newFileRepository is obsolete. You can remove it, although this should not related to this issue.

@d96patel
Copy link
Author

d96patel commented Jan 11, 2017

@superyyrrzz I am using docfx.msbuild version 2.4.0
https://www.nuget.org/packages/docfx.msbuild/2.4.0

I have now removed _gitContribute and newFileRepository but result is still the same.

@d96patel
Copy link
Author

d96patel commented Jan 11, 2017

@superyyrrzz I found out that I was using the docfx.msbuild which was wrong package. I have installed docfx.console nuget 2.10.2 and now "Improve this doc" and "View Source" are appearing.
However, when I click "Improve this doc", it leads me to "new page" in the repo. Is it because I am working on a local branch and have not pushed it to the server?
Here is the kind of format of the generated link. Documentation is the name of the project for docfx.

https://git.mycompany.com/dev/Development/new/master/Documentation/apispec/new?filename=name_of_the_file.md

When I click on "View Source", it leads me to 404 because it builds the link with the local branch name.

@superyyrrzz
Copy link
Contributor

For a reference page, if it hasn't an overwrite document, "Improve this doc" will link to a URL that help create a file to overwrite this page. If the remote branch exists, you can see what this URL does, instead of a 404.

@Konard
Copy link

Konard commented Aug 13, 2019

For me these two settings worked:

      "_gitContribute": {
        "branch": "master"
      },
      "_gitUrlPattern": "github"

"_gitUrlPattern": "github" alone was not enough.
https://github.com/linksplatform/Threading/blob/a7a64f2adb2a8db16a5624a0a59d37d54e5b9791/docfx.json#L28

@gumbarros
Copy link

gumbarros commented Dec 6, 2021

In our case, it worked with false as a boolean, not a string.

  "globalMetadata": {
      "_appTitle": "JJMasterData",
      "_disableContribution": false,
      "_gitContribute": {
        "branch": "master"
      },
      "_gitUrlPattern": "github"
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants