Skip to content

Commit 40c90e3

Browse files
authored
Add documentation regarding the ads.txt file (#2)
* Add documentation regarding the `ads.txt` file * Minor tweak
1 parent 360400e commit 40c90e3

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ filters:
4141
- adsense
4242
```
4343
44-
where `ca-pub-XXXXXXXXXXXXXXXX` in `publisher-id` is your Google Adsense [Publisher ID](https://support.google.com/adsense/answer/105516?hl=en).
44+
where `XXXXXXXXXXXXXXXX` in `publisher-id` is your Google Adsense [Publisher ID](https://support.google.com/adsense/answer/105516?hl=en).
4545

4646
If you wish to disable ads on a specific page, then add to the Quarto document's YAML header area:
4747

@@ -67,10 +67,44 @@ filters:
6767
---
6868
```
6969

70+
### Google Adsense Setup: Adding `ads.txt`
71+
72+
To ensure smooth integration with Google Adsense, it's essential to create a [standalone file named `ads.txt`](https://support.google.com/adsense/answer/12171612) within your project directory that identifies the domain as being authorized to serve ads. Follow these steps to include the `ads.txt` file:
73+
74+
1. **Create `ads.txt` File:**
75+
In the root of your project, create a new file named `ads.txt`.
76+
77+
2. **Add Google Publisher ID:**
78+
Open `ads.txt` and insert the following line, replacing `XXXXXXXXXXXXXXXX` with your actual [Google Publisher ID](https://support.google.com/adsense/answer/105516?hl=en):
79+
80+
```
81+
google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
82+
```
83+
84+
This line informs Google's web crawler about your association with the provided Publisher ID. For an example, please see the [`docs/ads.txt`](https://github.com/coatless-quarto/adsense/blob/main/README.md).
85+
86+
3. **Save and Include in Version Control:**
87+
Save the changes to `ads.txt` and ensure that the file is included in your version control system if you're using one.
88+
89+
4. **Register `ads.txt` in _quarto.yml:**
90+
Open the `_quarto.yml` configuration and add the `resources` line under the project key.
91+
92+
```yaml
93+
project:
94+
type: website # default, book, revealjs
95+
resources:
96+
- ads.txt
97+
```
98+
99+
This ensures the additional file resources are copied to the output directory.
100+
101+
This step is crucial for validating your ownership of the website and enabling a smooth interaction between your Quarto-generated content and Google Adsense. Remember to replace `XXXXXXXXXXXXXXXX` with your specific Google Publisher ID.
102+
70103
## References
71104

72105
- Google Adsense
73106
- [Google Adsense: Find Publisher ID](https://support.google.com/adsense/answer/105516?hl=en)
107+
- [Google Adsense: Ads.txt guide](https://support.google.com/adsense/answer/12171612)
74108
- [Google Adsense: Get and copy the AdSense code](https://support.google.com/adsense/answer/9274019?hl=en)
75109
- [Google Adsense: Where to place the AdSense code in your HTML](https://support.google.com/adsense/answer/9274516?sjid=14850419192472362507-NC)
76110
- Quarto

docs/ads.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0

docs/qgads-installation.qmd

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,39 @@ To seamlessly integrate the `adsense` extension into your Quarto project, follow
1818

1919
This command installs the `adsense` extension in the `_extensions` subdirectory of your Quarto project. If you're utilizing version control, make sure to include this directory in your repository.
2020

21+
## Google Adsense Setup: Adding `ads.txt`
22+
23+
To ensure smooth integration with Google Adsense, it's essential to create a [standalone file named `ads.txt`](https://support.google.com/adsense/answer/12171612) within your project directory that identifies the domain as being authorized to serve ads. Follow these steps to include your [Google Publisher ID](https://support.google.com/adsense/answer/105516?hl=en):
24+
25+
1. **Create `ads.txt` File:**
26+
In the root of your project, create a new file named `ads.txt`.
27+
28+
2. **Add Google Publisher ID:**
29+
Open `ads.txt` and insert the following line, replacing `XXXXXXXXXXXXXXXX` with your actual Google Publisher ID:
30+
31+
```
32+
google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
33+
```
34+
35+
This line informs Google's web crawler about your association with the provided Publisher ID. For an example, please see the [`docs/ads.txt`](https://github.com/coatless-quarto/adsense/blob/main/README.md).
36+
37+
3. **Save and Include in Version Control:**
38+
Save the changes to `ads.txt` and ensure that the file is included in your version control system if you're using one.
39+
40+
4. **Register `ads.txt` in _quarto.yml:**
41+
Open the `_quarto.yml` configuration and add the `resources` line under the project key.
42+
43+
```yaml
44+
project:
45+
type: website # default, book, revealjs
46+
resources:
47+
- ads.txt
48+
```
49+
50+
This ensures the additional file resources are copied to the output directory.
51+
52+
This step is crucial for validating your ownership of the website and enabling a smooth interaction between your Quarto-generated content and Google Adsense. Remember to replace `XXXXXXXXXXXXXXXX` with your specific Google Publisher ID.
53+
2154
## Usage
2255

2356
You can configure the `adsense` extension in either of the following ways:

docs/qgads-release-notes.qmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ format:
88
toc: true
99
---
1010

11+
12+
# 2.1.0-Dev: ??? (??-??-??) [DEV]
13+
14+
## Documentation
15+
16+
- Added documentation to both the README and Installation guide detailing the setup process of `ads.txt`. ([#1](https://github.com/coatless-quarto/adsense/issues/1), h/t [@JosiahParry](https://github.com/JosiahParry))
17+
1118
# 2.0.0: Selective Monetize (12-06-2023)
1219

1320
## Features

0 commit comments

Comments
 (0)