Link to project's GitLab pages from README - gitlab

I'd like to insert into the README.md file a link to the project's GitLab pages URL without hardcoding it.
Something like:
Visit the project's [pages site]($PROJECT_NAME_PAGES_URL)
instead of
Visit the project's [pages site](https://namespace.gitlab.io/project-name)
Is it possible?

No, GitLab-flavored markdown does not support any variables/substitutions like this. There are some cases where special gitlab references are allowed, but the GitLab pages URL is not one of them.
The only workaround might be to have a CI job that parses a readme template and updates the README.md on changes, obtaining the pages url from the predefined CI variable $CI_PAGES_URL -- something like what is described in this answer to a similar question.

Related

Gitlab README.md Variables

I would like to receive some help on how I could create some environment variables to be used in README.md within a locally hosted Gitlab instance.
I need two variables to be replaced in README.md when someone accesses the web interface, variables that define the name of the repo and the name of the branch.
Any idea is welcome.
Thanks!
I don't think you can use these variables inside a GitLab readme. There is a feature request for this but it isn't implemented yet.
A way around this is to use the predefined variables that are present in GitLab. However, these variables are accessible to GitLab's CI pipelines, and not to any readme files. But perhaps you can find a solution in this answer. It suggests that you keep a placeholder in your readme file, then have a job run that switches out the readme's placeholder with the required value using the sed command. Since the job will have access to both the readme file and the variables, this should work.

Can I use README files in github pages

I am working on a website to host on github, and I want to add README.md file, to let people know what exactly is it.
So is it ok to do that, would that end up in error
Yes, you can add a readme.md file to any Github repo. Github offers extensive documentation on how this works.
If I read into your question more deeply, I think what you're really asking is that if you add a readme to a project being hosted on Github pages - will that effect how the hosted website is presented? The answer would be no. In this case, read about how Github pages hosting works.

How to embed src file in a wiki in Gitlab/Github?

I have a doc folder in my project (in Gitlab) which contains documentation generated using jsdoc. This documentation is generated at build time.
What I want to do now is to embed the resulting index.html file in a wiki, so that on each build, the wiki is automatically updated.
Is there a way to do this?
You can clone your GLitab wiki locally.
That means, after each local build, you can add one step to your build in order to modify and embed the content of the generate files (here the resulting index.html), then add, commit and push back to your GitLab wiki.
As the OP tigermarques adds in the comments:
The only extra thing I had to do was to rename the .html file to either .md or .txt so that Gitlab would show it on the Wiki page list.

Update Gruntfile.js and Package.json across multiple projects

I am new to the world of grunt but I feel like there must be a way to do this. Hopefully I can explain my issue in a way that makes sense so you can be of assistance.
Essentially, I have a git project, including a gruntfile, that I use to start all new websites. I clone the project, delete the .git folder and setup a new project in bitbucket for it. Over time I have had to make some modifications to the gruntfile and it is annoying to go back to an old project where I hadn't made those modifications. Is there a recommended way to ensure that my template is up to date on all of my projects?
Things to note:
1) I am familiar with grunt scaffolding but I have never used it, is this the use case for it?
2) my projects live in bitbucket and are private. My initial solution to this problem was to use grunt curl and pull the latest and overwrite the previous gruntfile
3) The issue with #2 is that I would need to put my username/password in the path and can't figure out how to prompt the user, even if I do and they enter the login incorrectly bitbucket still returns something (a bad login page) and this would overwrite my gruntfile.
Thanks in advance! I appreciate anyones input
I assume you are using git with bitbucket. If that is the case you can do a pull from a master repo that contains your template grunt file in each of your project repositories for the desired effect.
See this answer for how to pull from a remote repo.
remote repo q
Since you only care about merging in changes from the Gruntfile.js you can pull it specifically from the remote template repo. I'd suggest following this pattern assuming you add the remote reference to you template repo when necessary:
From you project repo create a new branch
Pull the Gruntfile.js from the template repo
Resolve any merge conflicts
Merge with master
See the last answer on this question for how to pull a single file:
fetch a single file

Update a GitHub project wiki through the GitHub API

Is there a way a developer can automatically upload Doxygen documentation for his project hosted on GitHub through their API?
I didn't find anything on develop.github.com related to this. It would be nice if one could just SCP the files or something.
It's now possible to check out the wiki as a separate Git repository. You could clone the repository, add the pages to it, and push it. You can clone the repository from this URL:
git#github.com:user/project.wiki.git
There is no way, at this time, to access the GitHub wiki via the API. However, there is a much better solution already built into GitHub. Since Doxygen outputs static HTML pages, you can push them to the gh-pages branch of your project and access them at username.github.com/projectname
For more information, http://pages.github.com/.

Resources